Skip to content

Commit

Permalink
Also accept the DECSGR sequences for superscript/subscript control, f…
Browse files Browse the repository at this point in the history
…or greater compatibility
  • Loading branch information
leonerd committed Sep 6, 2022
1 parent 738ad3a commit 771e9b1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/seqs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ x = xterm
123x CSI l = RM, Reset mode
123x CSI ? l = DECRM, DEC reset mode
123x CSI m = SGR, Set Graphic Rendition
CSI ? m = DECSGR, private Set Graphic Rendition
123x CSI n = DSR, Device Status Report
23x 5 = operating status
23x 6 = CPR = cursor position
Expand Down
23 changes: 23 additions & 0 deletions src/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,29 @@ static int on_csi(const char *leader, const long args[], int argcount, const cha
vterm_state_setpen(state, args, argcount);
break;

case LEADER('?', 0x6d): // DECSGR
/* No actual DEC terminal recognised these, but some printers did. These
* are alternative ways to request subscript/superscript/off
*/
for(int argi = 0; argi < argcount; argi++) {
long arg;
switch(arg = CSI_ARG(args[argi])) {
case 4: // Superscript on
arg = 73;
vterm_state_setpen(state, &arg, 1);
break;
case 5: // Subscript on
arg = 74;
vterm_state_setpen(state, &arg, 1);
break;
case 24: // Super+subscript off
arg = 75;
vterm_state_setpen(state, &arg, 1);
break;
}
}
break;

case 0x6e: // DSR - ECMA-48 8.3.35
case LEADER('?', 0x6e): // DECDSR
val = CSI_ARG_OR(args[0], 0);
Expand Down

0 comments on commit 771e9b1

Please sign in to comment.