Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/notes-3.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ New Features in Terminal Sessions:
Settings > Profiles > Text.

Tabs, Windows, and UI:
- Closing a pinned tab now requires
confirmation, whether via the close
button, middle-click, ⌘W, or quitting
the app. The dialog identifies the tab
as pinned so the prompt is clear.
- The control-sequence-controlled progress
indicator is now shown in the tab bar.
- An active pane border can be displayed to
Expand Down
1 change: 1 addition & 0 deletions sources/AppShutdown/iTermPromptOnCloseReason.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
+ (instancetype)closingMultipleSessionsPreferenceEnabled;
+ (instancetype)tmuxClientsAlwaysPromptBecauseJobsAreNotExposed;
+ (instancetype)sessionIsLocked;
+ (instancetype)tabIsPinned;

- (void)addReason:(iTermPromptOnCloseReason *)reason;

Expand Down
4 changes: 4 additions & 0 deletions sources/AppShutdown/iTermPromptOnCloseReason.m
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ + (instancetype)sessionIsLocked {
return [[[iTermPromptOnCloseMessageReason alloc] initWithMessage:@"This pane is locked." priority:75] autorelease];
}

+ (instancetype)tabIsPinned {
return [[[iTermPromptOnCloseMessageReason alloc] initWithMessage:@"A pinned tab is open." priority:70] autorelease];
}

- (BOOL)hasReason {
return YES;
}
Expand Down
17 changes: 15 additions & 2 deletions sources/TerminalView/PseudoTerminal.m
Original file line number Diff line number Diff line change
Expand Up @@ -1941,14 +1941,21 @@ - (BOOL)confirmCloseTab:(PTYTab *)aTab suppressConfirmation:(BOOL)suppressConfir
const BOOL anyIsLocked = [[aTab sessions] anyWithBlock:^BOOL(PTYSession *anObject) {
return anObject.locked;
}];
NSString *const pinnedPrefix = aTab.isPinned ? @"pinned " : @"";
if (numClosing == 1) {
NSString *const identifier = anyIsLocked
? [NSString stringWithFormat:@"This %@tab (with a locked session)", pinnedPrefix]
: [NSString stringWithFormat:@"This %@tab", pinnedPrefix];
okToClose = [self confirmCloseForSessions:[aTab sessions]
identifier:anyIsLocked ? @"This tab (with a locked session)" : @"This tab"
identifier:identifier
genericName:[NSString stringWithFormat:@"tab #%d",
[aTab tabNumber]]];
} else {
NSString *const identifier = anyIsLocked
? [NSString stringWithFormat:@"This %@multi-pane tab (with locked sessions)", pinnedPrefix]
: [NSString stringWithFormat:@"This %@multi-pane tab", pinnedPrefix];
okToClose = [self confirmCloseForSessions:[aTab sessions]
identifier:anyIsLocked ? @"This multi-pane tab (with locked sessions)" : @"This multi-pane tab"
identifier:identifier
genericName:[NSString stringWithFormat:@"tab #%d",
[aTab tabNumber]]];
}
Expand Down Expand Up @@ -4175,6 +4182,12 @@ - (iTermPromptOnCloseReason *)promptOnCloseReason {
for (PTYSession *aSession in [self allSessions]) {
[reason addReason:[aSession promptOnCloseReason]];
}
for (PTYTab *tab in self.tabs) {
if (tab.isPinned) {
[reason addReason:[iTermPromptOnCloseReason tabIsPinned]];
break;
}
}
return reason;
}

Expand Down