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

Add a status touchbar item.

parent 1cdc0b4a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -7181,7 +7181,7 @@
DevelopmentTeam = H7V7XYVQ7D;
};
874206460564169600CFC3F1 = {
DevelopmentTeam = H7V7XYVQ7D;
DevelopmentTeam = CMC4EL7UVS;
ProvisioningStyle = Automatic;
};
A66717851DCE36C3000CE608 = {
Loading
Loading
@@ -8958,7 +8958,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEVELOPMENT_TEAM = H7V7XYVQ7D;
DEVELOPMENT_TEAM = CMC4EL7UVS;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
@@ -10138,7 +10138,7 @@
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = H7V7XYVQ7D;
DEVELOPMENT_TEAM = CMC4EL7UVS;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
@@ -10207,7 +10207,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEVELOPMENT_TEAM = H7V7XYVQ7D;
DEVELOPMENT_TEAM = CMC4EL7UVS;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
@@ -710,6 +710,8 @@ typedef enum {
// Undoes burying of a session.
- (void)disinter;
 
- (void)jumpToLocationWhereCurrentStatusChanged;
#pragma mark - API
 
- (ITMGetBufferResponse *)handleGetBufferRequest:(ITMGetBufferRequest *)request;
Loading
Loading
Loading
Loading
@@ -472,6 +472,9 @@ static const NSUInteger kMaxHosts = 100;
uint32_t _autoLogId;
 
iTermCopyModeState *_copyModeState;
// Absolute line number where touchbar status changed.
long long _statusChangedAbsLine;
}
 
+ (void)registerSessionInArrangement:(NSDictionary *)arrangement {
Loading
Loading
@@ -553,6 +556,8 @@ static const NSUInteger kMaxHosts = 100;
_locationChangeSubscriptions = [[NSMutableDictionary alloc] init];
_customEscapeSequenceNotifications = [[NSMutableDictionary alloc] init];
 
_statusChangedAbsLine = -1;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(coprocessChanged)
name:@"kCoprocessStatusChangeNotification"
Loading
Loading
@@ -1901,6 +1906,14 @@ ITERM_WEAKLY_REFERENCEABLE
_textview = nil;
}
 
- (void)jumpToLocationWhereCurrentStatusChanged {
if (_statusChangedAbsLine >= _screen.totalScrollbackOverflow) {
int line = _statusChangedAbsLine - _screen.totalScrollbackOverflow;
[_textview scrollLineNumberRangeIntoView:VT100GridRangeMake(line, 1)];
[_textview highlightMarkOnLine:line hasErrorCode:NO];
}
}
- (void)disinter {
_textview.dataSource = _screen;
_textview.delegate = self;
Loading
Loading
@@ -8578,7 +8591,14 @@ ITERM_WEAKLY_REFERENCEABLE
if (!_keyLabels) {
_keyLabels = [[NSMutableDictionary alloc] init];
}
_keyLabels[keyName] = [[label copy] autorelease];
if (label.length == 0) {
[_keyLabels removeObjectForKey:keyName];
} else {
_keyLabels[keyName] = [[label copy] autorelease];
}
if ([keyName isEqualToString:@"status"]) {
_statusChangedAbsLine = _screen.cursorY - 1 + _screen.numberOfScrollbackLines + _screen.totalScrollbackOverflow;
}
[_delegate sessionKeyLabelsDidChange:self];
}
 
Loading
Loading
Loading
Loading
@@ -31,6 +31,7 @@ static NSString *const iTermTouchBarIdentifierFunctionKeys = @"iTermTouchBarIden
static NSString *const iTermTouchBarIdentifierColorPresetScrollview = @"iTermTouchBarIdentifierColorPresetScrollview";
static NSString *const iTermTouchBarIdentifierAutocomplete = @"iTermTouchBarIdentifierAutocomplete";
static NSString *const iTermTouchBarFunctionKeysScrollView = @"iTermTouchBarFunctionKeysScrollView";
static NSString *const iTermTouchBarIdentifierStatus = @"iTermTouchBarIdentifierStatus";
 
ITERM_IGNORE_PARTIAL_BEGIN
 
Loading
Loading
@@ -50,6 +51,7 @@ ITERM_IGNORE_PARTIAL_BEGIN
item = [popoverTouchBar itemForIdentifier:iTermTouchBarFunctionKeysScrollView];
scrollView = (NSScrollView *)item.view;
[self updateTouchBarFunctionKeyLabelsInScrollView:scrollView];
[self updateStatus];
}
 
- (void)updateTouchBarWithWordAtCursor:(NSString *)word {
Loading
Loading
@@ -62,6 +64,23 @@ ITERM_IGNORE_PARTIAL_BEGIN
}
}
 
- (void)updateStatus {
NSTouchBarItem *item = [self.touchBar itemForIdentifier:iTermTouchBarIdentifierStatus];
if (item) {
iTermTouchBarButton *button = (iTermTouchBarButton *)item.view;
NSString *touchBarStatusString = self.currentSession.keyLabels[@"status"];
if (touchBarStatusString == nil) {
button.title = @"Status";
button.enabled = NO;
item.visibilityPriority = NSTouchBarItemPriorityLow;
} else {
button.title = touchBarStatusString;
button.enabled = YES;
item.visibilityPriority = NSTouchBarItemPriorityNormal;
}
}
}
- (void)updateTouchBarFunctionKeyLabelsInScrollView:(NSScrollView *)scrollView {
if (!scrollView) {
return;
Loading
Loading
@@ -120,7 +139,8 @@ ITERM_IGNORE_PARTIAL_BEGIN
iTermTouchBarIdentifierAddMark,
iTermTouchBarIdentifierNextMark,
iTermTouchBarIdentifierPreviousMark,
iTermTouchBarIdentifierAutocomplete ];
iTermTouchBarIdentifierAutocomplete,
iTermTouchBarIdentifierStatus ];
ids = [ids arrayByAddingObjectsFromArray:[iTermKeyBindingMgr sortedTouchBarKeysInDictionary:[iTermKeyBindingMgr globalTouchBarMap]]];
self.touchBar.customizationAllowedItemIdentifiers = ids;
[self updateTouchBarFunctionKeyLabels];
Loading
Loading
@@ -341,6 +361,9 @@ ITERM_IGNORE_PARTIAL_BEGIN
if ([identifier isEqualToString:iTermTouchBarIdentifierManPage]) {
selector = @selector(manPageTouchBarItemSelected:);
label = @"Man Page";
} else if ([identifier isEqualToString:iTermTouchBarIdentifierStatus]) {
selector = @selector(statusTouchBarItemSelected:);
label = @"Your Message Here";
} else if ([identifier isEqualToString:iTermTouchBarIdentifierAddMark]) {
image = [[NSImage imageNamed:@"Add Mark Touch Bar Icon"] imageWithColor:[NSColor labelColor]];
selector = @selector(addMarkTouchBarItemSelected:);
Loading
Loading
@@ -456,6 +479,10 @@ ITERM_IGNORE_PARTIAL_BEGIN
}
}
 
- (void)statusTouchBarItemSelected:(iTermTouchBarButton *)sender {
[self.currentSession jumpToLocationWhereCurrentStatusChanged];
}
- (void)colorPresetTouchBarItemSelected:(iTermTouchBarButton *)sender {
[self.currentSession setColorsFromPresetNamed:sender.keyBindingAction[@"presetName"]];
}
Loading
Loading
Loading
Loading
@@ -2259,7 +2259,7 @@ static const int kMaxScreenRows = 4096;
}
} else if ([key isEqualToString:@"SetKeyLabel"]) {
NSInteger i = [value rangeOfString:@"="].location;
if (i != NSNotFound && i > 0 && i + 1 < value.length) {
if (i != NSNotFound && i > 0 && i + 1 <= value.length) {
NSString *keyName = [value substringToIndex:i];
NSString *label = [value substringFromIndex:i + 1];
[delegate_ terminalSetLabel:label forKey:keyName];
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