Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support DECSCUSR (Issue 2165) #92

Merged
merged 2 commits into from Oct 6, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions VT100Screen.m
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions VT100Terminal.h
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions VT100Terminal.m
Expand Up @@ -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 {
Expand Down Expand Up @@ -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--;
Expand Down Expand Up @@ -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 '@':
Expand Down