Add support for CSI s/u used by some old programs

This commit is contained in:
Kovid Goyal 2016-12-14 10:19:51 +05:30
parent 527a92d1f6
commit 1648ac1036
2 changed files with 20 additions and 0 deletions

View File

@ -231,6 +231,12 @@
// Forward tab // Forward tab
#define CHT 'I' #define CHT 'I'
// Save cursor
#define SC 's'
// Restore cursor
#define RC 'u'
// Misc sequences // Misc sequences
// ---------------- // ----------------

View File

@ -321,6 +321,16 @@ static inline void
screen_tabn(Screen *s, unsigned int count) { for (index_type i=0; i < MAX(1, count); i++) screen_tab(s); } screen_tabn(Screen *s, unsigned int count) { for (index_type i=0; i < MAX(1, count); i++) screen_tab(s); }
static inline void static inline void
screen_reverse_indexn(Screen *s, unsigned int count) { for (index_type i=0; i < count; i++) screen_reverse_index(s); } screen_reverse_indexn(Screen *s, unsigned int count) { for (index_type i=0; i < count; i++) screen_reverse_index(s); }
static inline void
save_cursor(Screen *s, unsigned int UNUSED param, bool private) {
if (private) fprintf(stderr, "%s %s", ERROR_PREFIX, "CSI s in private mode not supported");
else screen_save_cursor(s);
}
static inline void
restore_cursor(Screen *s, unsigned int UNUSED param, bool private) {
if (private) fprintf(stderr, "%s %s", ERROR_PREFIX, "CSI u in private mode not supported");
else screen_restore_cursor(s);
}
static inline void static inline void
dispatch_csi(Screen *screen, PyObject DUMP_UNUSED *dump_callback) { dispatch_csi(Screen *screen, PyObject DUMP_UNUSED *dump_callback) {
@ -445,6 +455,10 @@ dispatch_csi(Screen *screen, PyObject DUMP_UNUSED *dump_callback) {
CSI_HANDLER_MULTIPLE(select_graphic_rendition); CSI_HANDLER_MULTIPLE(select_graphic_rendition);
case DSR: case DSR:
CALL_CSI_HANDLER1P(report_device_status, 0, '?'); CALL_CSI_HANDLER1P(report_device_status, 0, '?');
case SC:
CALL_CSI_HANDLER1P(save_cursor, 0, '?');
case RC:
CALL_CSI_HANDLER1P(restore_cursor, 0, '?');
case DECSTBM: case DECSTBM:
CALL_CSI_HANDLER2(screen_set_margins, 0, 0); CALL_CSI_HANDLER2(screen_set_margins, 0, 0);
case DECSCUSR: case DECSCUSR: