Handle the XTMODKEYS escape code
Treat the XTerm specific modifyOtherKeys escape codes as putting the disambiguate mode on/off the stack. The escape code causes XTerm to use a (broken, naturally) variant of CSI u encoding for many keys, so we treat it as going into the disambiguate mode.
This commit is contained in:
parent
a548c31d50
commit
d360d077d1
@ -260,6 +260,11 @@ and alternate screens. If a pop request is received that empties the stack,
|
||||
all flags are reset. If a push request is received and the stack is full, the
|
||||
oldest entry from the stack must be evicted.
|
||||
|
||||
.. note:: In the interests of interoperation, the XTerm specific sequences
|
||||
`CSI > 4; 1 m` and `CSI > 4; 0 m` are treated as `CSI > 1 u` and `CSI < 1 u`.
|
||||
These codes cause XTerm to use the CSI u encoding for more keys and are therefore
|
||||
treated as similar to the disambiguate progressive enhancement.
|
||||
|
||||
.. _disambiguate:
|
||||
|
||||
Disambiguate escape codes
|
||||
|
||||
@ -943,7 +943,7 @@ dispatch_csi(Screen *screen, PyObject DUMP_UNUSED *dump_callback) {
|
||||
break;
|
||||
case 'm':
|
||||
if (start_modifier == '>' && !end_modifier) {
|
||||
REPORT_ERROR("Ignoring xterm specific key modifier resource options (CSI > m)");
|
||||
CALL_CSI_HANDLER2(screen_xtmodkeys, 0, 0);
|
||||
break;
|
||||
}
|
||||
/* fallthrough */
|
||||
|
||||
@ -886,6 +886,16 @@ screen_pop_key_encoding_flags(Screen *self, uint32_t num) {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
screen_xtmodkeys(Screen *self, uint32_t p1, uint32_t p2) {
|
||||
// this is the legacy XTerm escape code for modify keys
|
||||
// https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-gt-Pp-m.1DB2
|
||||
// we handle them as being equivalent to push and pop 1 onto the keyboard stack
|
||||
if ((!p1 && !p2) || (p1 == 4 && p2 == 0)) screen_pop_key_encoding_flags(self, 1);
|
||||
else if (p1 == 4 && p2 == 1) screen_push_key_encoding_flags(self, 1);
|
||||
}
|
||||
|
||||
|
||||
// }}}
|
||||
|
||||
// Cursor {{{
|
||||
|
||||
@ -229,6 +229,7 @@ void screen_push_key_encoding_flags(Screen *self, uint32_t val);
|
||||
void screen_pop_key_encoding_flags(Screen *self, uint32_t num);
|
||||
uint8_t screen_current_key_encoding_flags(Screen *self);
|
||||
void screen_report_key_encoding_flags(Screen *self);
|
||||
void screen_xtmodkeys(Screen *self, uint32_t p1, uint32_t p2);
|
||||
#define DECLARE_CH_SCREEN_HANDLER(name) void screen_##name(Screen *screen);
|
||||
DECLARE_CH_SCREEN_HANDLER(bell)
|
||||
DECLARE_CH_SCREEN_HANDLER(backspace)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user