Skip to content

Commit

Permalink
Good attempt at single window but has edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jbtule committed Oct 9, 2019
1 parent 890b371 commit 8242396
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion cd to .../cd to .../main.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,24 @@ int main(int argc, const char * argv[]) {


if (url != nil){
[terminal activate];
if ([[terminal windows] count] == 1){
TerminalWindow* win = [[terminal windows] objectAtLocation:@1];
if([[win tabs] count] == 1){
TerminalTab* tab = [[win tabs] objectAtLocation:@1];
if(![tab busy]){
NSUInteger rows = [tab numberOfRows];
NSString* hist = [tab history];
NSInteger histLength = [[hist componentsSeparatedByCharactersInSet:
[NSCharacterSet newlineCharacterSet]] count];
//a signle
if(rows + 1 >= histLength){
[win closeSaving:TerminalSaveOptionsNo savingIn:nil];
}
}
}
}
[terminal open:@[url]];
[terminal activate];
}
}
}

0 comments on commit 8242396

Please sign in to comment.