Skip to content

Commit

Permalink
Add support for DECSCUSR 0 to reset cursor style & blink to user defa…
Browse files Browse the repository at this point in the history
…ult. Issue 8769
  • Loading branch information
gnachman committed May 14, 2020
1 parent 2d3b9a8 commit 5680f97
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
5 changes: 5 additions & 0 deletions sources/PTYSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -9285,6 +9285,11 @@ - (void)screenSetCursorBlinking:(BOOL)blink {
[[self textview] setBlinkingCursor:blink];
}

- (void)screenResetCursorTypeAndBlink {
self.cursorTypeOverride = nil;
self.textview.blinkingCursor = [iTermProfilePreferences boolForKey:KEY_BLINKING_CURSOR inProfile:self.profile];
}

- (void)screenGetCursorType:(ITermCursorType *)cursorTypeOut
blinking:(BOOL *)blinking {
*cursorTypeOut = self.cursorType;
Expand Down
4 changes: 4 additions & 0 deletions sources/VT100Screen.m
Original file line number Diff line number Diff line change
Expand Up @@ -3284,6 +3284,10 @@ - (void)terminalGetCursorType:(ITermCursorType *)cursorTypeOut
[delegate_ screenGetCursorType:cursorTypeOut blinking:blinking];
}

- (void)terminalResetCursorTypeAndBlink {
[delegate_ screenResetCursorTypeAndBlink];
}

- (void)terminalSetLeftMargin:(int)scrollLeft rightMargin:(int)scrollRight {
if (currentGrid_.useScrollRegionCols) {
currentGrid_.scrollRegionCols = VT100GridRangeMake(scrollLeft,
Expand Down
3 changes: 3 additions & 0 deletions sources/VT100ScreenDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
- (void)screenGetCursorType:(ITermCursorType *)cursorTypeOut
blinking:(BOOL *)blinking;

- (void)screenResetCursorTypeAndBlink;


// Returns if the screen is permitted to resize the window.
- (BOOL)screenShouldInitiateWindowResize;

Expand Down
14 changes: 8 additions & 6 deletions sources/VT100Terminal.m
Original file line number Diff line number Diff line change
Expand Up @@ -1676,28 +1676,30 @@ - (void)executeToken:(VT100Token *)token {
case VT100CSI_DECSCUSR:
switch (token.csi->p[0]) {
case 0:
[delegate_ terminalResetCursorTypeAndBlink];
break;
case 1:
[delegate_ terminalSetCursorBlinking:true];
[delegate_ terminalSetCursorBlinking:YES];
[delegate_ terminalSetCursorType:CURSOR_BOX];
break;
case 2:
[delegate_ terminalSetCursorBlinking:false];
[delegate_ terminalSetCursorBlinking:NO];
[delegate_ terminalSetCursorType:CURSOR_BOX];
break;
case 3:
[delegate_ terminalSetCursorBlinking:true];
[delegate_ terminalSetCursorBlinking:YES];
[delegate_ terminalSetCursorType:CURSOR_UNDERLINE];
break;
case 4:
[delegate_ terminalSetCursorBlinking:false];
[delegate_ terminalSetCursorBlinking:NO];
[delegate_ terminalSetCursorType:CURSOR_UNDERLINE];
break;
case 5:
[delegate_ terminalSetCursorBlinking:true];
[delegate_ terminalSetCursorBlinking:YES];
[delegate_ terminalSetCursorType:CURSOR_VERTICAL];
break;
case 6:
[delegate_ terminalSetCursorBlinking:false];
[delegate_ terminalSetCursorBlinking:NO];
[delegate_ terminalSetCursorType:CURSOR_VERTICAL];
break;
}
Expand Down
3 changes: 3 additions & 0 deletions sources/VT100TerminalDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ typedef NS_ENUM(int, VT100TerminalColorIndex) {
// Changes whether the cursor blinks.
- (void)terminalSetCursorBlinking:(BOOL)blinking;

// Reset type and blink to default
- (void)terminalResetCursorTypeAndBlink;

// Returns the current cursor style as a DECSCUSR param.
- (void)terminalGetCursorType:(ITermCursorType *)cursorTypeOut
blinking:(BOOL *)blinking;
Expand Down

0 comments on commit 5680f97

Please sign in to comment.