csi: simplify handling of Set/Reset Mode (SM/RM) sequences

This commit is contained in:
Craig Barnes 2024-01-25 01:07:53 +00:00 committed by Daniel Eklöf
parent 91b22ae21a
commit 44c0cf594b
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

51
csi.c
View file

@ -1081,44 +1081,29 @@ csi_dispatch(struct terminal *term, uint8_t final)
break; break;
case 'h': case 'h':
/* Set mode */ case 'l': {
switch (vt_param_get(term, 0, 0)) { /* Set/Reset Mode (SM/RM) */
case 2: /* Keyboard Action Mode - AM */ int param = vt_param_get(term, 0, 0);
LOG_WARN("unimplemented: keyboard action mode (AM)"); bool sm = final == 'h';
break; if (param == 4) {
/* Insertion Replacement Mode (IRM) */
case 4: /* Insert Mode - IRM */ term->insert_mode = sm;
term->insert_mode = true;
term_update_ascii_printer(term); term_update_ascii_printer(term);
break; break;
}
case 12: /* Send/receive Mode - SRM */ /*
LOG_WARN("unimplemented: send/receive mode (SRM)"); * ECMA-48 defines modes 1-22, all of which were optional
break; * (§7.1; "may have one state only") and are considered
* deprecated (§7.1) in the latest (5th) edition. xterm only
case 20: /* Automatic Newline Mode - LNM */ * documents modes 2, 4, 12 and 20, the last of which was
/* TODO: would be easy to implemented; when active * outright removed (§8.3.106) in 5th edition ECMA-48.
* term_linefeed() would _also_ do a */
* term_carriage_return() */ if (sm) {
LOG_WARN("unimplemented: automatic newline mode (LNM)"); LOG_WARN("SM with unimplemented mode: %d", param);
break;
}
break;
case 'l':
/* Reset mode */
switch (vt_param_get(term, 0, 0)) {
case 4: /* Insert Mode - IRM */
term->insert_mode = false;
term_update_ascii_printer(term);
break;
case 2: /* Keyboard Action Mode - AM */
case 12: /* Send/receive Mode - SRM */
case 20: /* Automatic Newline Mode - LNM */
break;
} }
break; break;
}
case 'r': { case 'r': {
int start = vt_param_get(term, 0, 1); int start = vt_param_get(term, 0, 1);