Skip to content
Snippets Groups Projects
Commit 04b8ebf6 authored by George Nachman's avatar George Nachman
Browse files

Use set-control-client-attr ready instead of start-control. Use dump-state for...

Use set-control-client-attr ready instead of start-control. Use dump-state for history. Remove -C arg from list-windows and use -F format instead
parent 3aab4e85
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -60,6 +60,7 @@
#define DEBUG_KEYDOWNDUMP 0
#define ASK_ABOUT_OUTDATED_FORMAT @"AskAboutOutdatedKeyMappingForGuid%@"
 
//#define TMUX_VERBOSE_LOGGING
#ifdef TMUX_VERBOSE_LOGGING
#define TmuxLog NSLog
#else
Loading
Loading
Loading
Loading
@@ -23,12 +23,12 @@
 
@interface TSVParser : NSObject
 
+ (TSVDocument *)documentFromString:(NSString *)string;
+ (TSVDocument *)documentFromString:(NSString *)string withFields:(NSArray *)fields;
 
@end
 
@interface NSString (TSV)
 
- (TSVDocument *)tsvDocument;
- (TSVDocument *)tsvDocumentWithFields:(NSArray *)fields;
 
@end
\ No newline at end of file
Loading
Loading
@@ -52,16 +52,15 @@
 
@implementation TSVParser
 
+ (TSVDocument *)documentFromString:(NSString *)string
+ (TSVDocument *)documentFromString:(NSString *)string withFields:(NSArray *)fields
{
NSArray *lines = [string componentsSeparatedByString:@"\n"];
if ([lines count] == 0) {
return nil;
}
TSVDocument *doc = [[[TSVDocument alloc] init] autorelease];
NSString *header = [lines objectAtIndex:0];
doc.columns = [[[header componentsSeparatedByString:@"\t"] mutableCopy] autorelease];
for (int i = 1; i < lines.count; i++) {
doc.columns = [[fields copy] autorelease];
for (int i = 0; i < lines.count; i++) {
NSString *row = [lines objectAtIndex:i];
[doc.records addObject:[row componentsSeparatedByString:@"\t"]];
}
Loading
Loading
@@ -72,9 +71,9 @@
 
@implementation NSString (TSV)
 
- (TSVDocument *)tsvDocument
- (TSVDocument *)tsvDocumentWithFields:(NSArray *)fields
{
return [TSVParser documentFromString:self];
return [TSVParser documentFromString:self withFields:fields];
}
 
@end
\ No newline at end of file
Loading
Loading
@@ -16,6 +16,12 @@
#import "PTYTab.h"
#import "RegexKitLite.h"
 
static NSString *kListWindowsFormat = @"\"#{session_name}\t#{window_id}\t"
"#{window_name}\t"
"#{window_width}\t#{window_height}\t"
"#{window_layout_ex}\t"
"#{?window_active,1,0}\"";
@interface TmuxController (Private)
 
- (void)retainWindow:(int)window withTab:(PTYTab *)tab;
Loading
Loading
@@ -76,9 +82,17 @@
[windowOpener updateLayoutInTab:tab];
}
 
- (NSArray *)listWindowFields
{
return [NSArray arrayWithObjects:@"session_name", @"window_id",
@"window_name", @"window_width", @"window_height",
@"window_layout", @"window_active", nil];
}
- (void)initialListWindowsResponse:(NSString *)response
{
TSVDocument *doc = [response tsvDocument];
TSVDocument *doc = [response tsvDocumentWithFields:[self listWindowFields]];
if (!doc) {
[gateway_ abortWithErrorMessage:[NSString stringWithFormat:@"Bad response for initial list windows request: %@", response]];
return;
Loading
Loading
@@ -94,7 +108,7 @@
 
- (void)openWindowsInitial
{
[gateway_ sendCommand:@"list-windows -C"
[gateway_ sendCommand:[NSString stringWithFormat:@"list-windows -F %@", kListWindowsFormat]
responseTarget:self
responseSelector:@selector(initialListWindowsResponse:)];
}
Loading
Loading
@@ -265,7 +279,7 @@
- (void)openWindowWithId:(int)windowId
{
// Get the window's basic info to prep the creation of a TmuxWindowOpener.
[gateway_ sendCommand:[NSString stringWithFormat:@"list-windows -C -I %d", windowId]
[gateway_ sendCommand:[NSString stringWithFormat:@"list-windows -F %@ -I %d", kListWindowsFormat, windowId]
responseTarget:self
responseSelector:@selector(listedWindowsToOpenOne:forWindowId:)
responseObject:[NSNumber numberWithInt:windowId]];
Loading
Loading
@@ -305,7 +319,7 @@
 
- (void)listedWindowsToOpenOne:(NSString *)response forWindowId:(NSNumber *)windowId
{
TSVDocument *doc = [response tsvDocument];
TSVDocument *doc = [response tsvDocumentWithFields:[self listWindowFields]];
if (!doc) {
[gateway_ abortWithErrorMessage:[NSString stringWithFormat:@"Bad response for list windows request: %@",
response]];
Loading
Loading
Loading
Loading
@@ -10,6 +10,7 @@
#import "TmuxController.h"
#import "iTermApplicationDelegate.h"
 
//#define TMUX_VERBOSE_LOGGING
#ifdef TMUX_VERBOSE_LOGGING
#define TmuxLog NSLog
#else
Loading
Loading
Loading
Loading
@@ -88,10 +88,10 @@
callingSelector:@selector(appendRequestsForNode:toArray:)
onTarget:self
withObject:cmdList];
// append start-control
if (initial) {
[cmdList addObject:[self dictForStartControlCommand]];
}
// append start-control
[gateway_ sendCommandList:cmdList];
}
 
Loading
Loading
@@ -143,7 +143,8 @@
- (NSDictionary *)dictForStartControlCommand
{
++pendingRequests_;
return [gateway_ dictionaryForCommand:@"start-control"
NSString *command = @"set-control-client-attr ready";
return [gateway_ dictionaryForCommand:command
responseTarget:self
responseSelector:@selector(requestDidComplete)
responseObject:nil];
Loading
Loading
@@ -170,7 +171,7 @@
- (NSDictionary *)dictForDumpStateForWindowPane:(NSNumber *)wp
{
++pendingRequests_;
NSString *command = [NSString stringWithFormat:@"dump-state -t %%%d", [wp intValue]];
NSString *command = [NSString stringWithFormat:@"dump-state -e -t %%%d", [wp intValue]];
return [gateway_ dictionaryForCommand:command
responseTarget:self
responseSelector:@selector(dumpStateResponse:pane:)
Loading
Loading
@@ -181,7 +182,7 @@
alt:(BOOL)alternate
{
++pendingRequests_;
NSString *command = [NSString stringWithFormat:@"dump-history %@-t %%%d -l 1000",
NSString *command = [NSString stringWithFormat:@"dump-state -h %@-t %%%d -l 1000",
(alternate ? @"-a " : @""), [wp intValue]];
return [gateway_ dictionaryForCommand:command
responseTarget:self
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment