Skip to content

Commit

Permalink
Support DECSCUSR
Browse files Browse the repository at this point in the history
  • Loading branch information
saitoha committed Oct 5, 2012
1 parent ca1578b commit 1c541eb
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
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_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_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_COMMAND(' ', 'q'):
result.type = VT100CSI_DECSCUSR;
SET_PARAM_DEFAULT(param, 0, 0);
break;

// these are xterm controls
case '@':
Expand Down

0 comments on commit 1c541eb

Please sign in to comment.