Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Support DECSCUSR (Issue 2165) #92

Merged
merged 2 commits into from

2 participants

Hayaki Saito gnachman
Hayaki Saito

Issue 2165: Support Set cursor style (DECSCUSR, VT520) escape codes.
http://code.google.com/p/iterm2/issues/detail?id=2165#makechanges

By xterm patch #282, DECSCUSR 5/6 (blinking bar/steady bar, they are not VT's features) are supported.
These features are already supported by MinTTY/TeraTerm/RLogin.
I think this change was intended to improve the interoperability between them.
If iTerm support this, it will help terminal application developers.

gnachman
Owner

Looks great, thank you!

gnachman gnachman merged commit ef523c6 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 5, 2012
  1. Hayaki Saito

    Support DECSCUSR

    saitoha authored
  2. Hayaki Saito
This page is out of date. Refresh to see the latest.
Showing with 56 additions and 0 deletions.
  1. +32 −0 VT100Screen.m
  2. +1 −0  VT100Terminal.h
  3. +23 −0 VT100Terminal.m
32 VT100Screen.m
View
@@ -1571,6 +1571,38 @@ - (void)putToken:(VT100TCC)token
break;
case VT100CSI_RM:
break;
+ case VT100CSI_DECSCUSR:
+ switch (token.u.csi.p[0]) {
+ case 0:
+ case 1:
+ [[SESSION TEXTVIEW] setBlinkingCursor:true];
+ [[SESSION TEXTVIEW] setCursorType:CURSOR_BOX];
+ break;
+ case 2:
+ [[SESSION TEXTVIEW] setBlinkingCursor:false];
+ [[SESSION TEXTVIEW] setCursorType:CURSOR_BOX];
+ break;
+ case 3:
+ [[SESSION TEXTVIEW] setBlinkingCursor:true];
+ [[SESSION TEXTVIEW] setCursorType:CURSOR_UNDERLINE];
+ break;
+ case 4:
+ [[SESSION TEXTVIEW] setBlinkingCursor:false];
+ [[SESSION TEXTVIEW] setCursorType:CURSOR_UNDERLINE];
+ break;
+ case 5:
+ [[SESSION TEXTVIEW] setBlinkingCursor:true];
+ [[SESSION TEXTVIEW] setCursorType:CURSOR_VERTICAL];
+ break;
+ case 6:
+ [[SESSION TEXTVIEW] setBlinkingCursor:false];
+ [[SESSION TEXTVIEW] setCursorType:CURSOR_VERTICAL];
+ break;
+ default:
+ //NSLog(@"DECSCUSR: Unrecognized parameter: %d", token.u.csi.p[0]);
+ break;
+ }
+ break;
/* My interpretation of this:
* http://www.cl.cam.ac.uk/~mgk25/unicode.html#term
1  VT100Terminal.h
View
@@ -100,6 +100,7 @@
#define VT100CSI_SGR 2045 // Select Graphic Rendition
#define VT100CSI_SM 2046 // Set Mode
#define VT100CSI_TBC 2047 // Tabulation Clear
+#define VT100CSI_DECSCUSR 2048 // Select the Style of the Cursor
// some xterm extension
#define XTERMCC_WIN_TITLE 86 // Set window title
23 VT100Terminal.m
View
@@ -134,6 +134,7 @@ Simplifed Chinese (EUC_CN)
#define REPORT_VT52 "\033/Z"
#define conststr_sizeof(n) ((sizeof(n)) - 1)
+#define MAKE_CSI_COMMAND(first, second) ((first << 8) | second)
typedef struct {
@@ -319,6 +320,23 @@ static size_t getCSIParam(unsigned char *datap,
datap++;
break;
}
+ else if (*datap == ' ') {
+ datap++;
+ datalen--;
+ switch (*datap) {
+ case 'q':
+ param->cmd = MAKE_CSI_COMMAND(' ', 'q');
+ datap++;
+ datalen--;
+ return datap - orgp;
+ default:
+ //NSLog(@"Unrecognized sequence: CSI SP %c (0x%x)", *datap, *datap);
+ datap++;
+ datalen--;
+ param->cmd = 0xff;
+ break;
+ }
+ }
else if (*datap=='\'') {
datap++;
datalen--;
@@ -538,6 +556,11 @@ static VT100TCC decode_csi(unsigned char *datap,
result.type = VT100CSI_TBC;
SET_PARAM_DEFAULT(param, 0, 0);
break;
+
+ case MAKE_CSI_COMMAND(' ', 'q'):
+ result.type = VT100CSI_DECSCUSR;
+ SET_PARAM_DEFAULT(param, 0, 0);
+ break;
// these are xterm controls
case '@':
Something went wrong with that request. Please try again.