From 56793ca04f711e17173cdc82c7936d74bc614d71 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 1 Jun 2017 04:43:34 -0400 Subject: actually, we probably should support utf8 as a mouse reporting mode --- src/parser.c | 16 ++++++---------- src/parser.l | 16 ++++++---------- src/screen.c | 13 +++++++++---- src/screen.h | 18 +++++++++++++----- 4 files changed, 34 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/parser.c b/src/parser.c index 4eeea45..a4508c7 100644 --- a/src/parser.c +++ b/src/parser.c @@ -2723,13 +2723,13 @@ static void vt100_parser_handle_ris(VT100Screen *vt) vt100_screen_save_cursor(vt); vt100_screen_reset_text_attributes(vt); vt100_screen_show_cursor(vt); + vt100_screen_set_mouse_reporting_normal_mode(vt); vt100_screen_reset_application_keypad(vt); vt100_screen_reset_application_cursor(vt); vt100_screen_reset_mouse_reporting_press(vt); vt100_screen_reset_mouse_reporting_press_release(vt); vt100_screen_reset_mouse_reporting_button_motion(vt); vt100_screen_reset_mouse_reporting_any_motion(vt); - vt100_screen_reset_mouse_reporting_sgr_mode(vt); vt100_screen_reset_bracketed_paste(vt); vt100_screen_reset_origin_mode(vt); } @@ -3054,6 +3054,9 @@ static void vt100_parser_handle_sm(VT100Screen *vt, char *buf, size_t len) case 1003: vt100_screen_set_mouse_reporting_any_motion(vt); break; + case 1005: + vt100_screen_set_mouse_reporting_utf8_mode(vt); + break; case 1006: vt100_screen_set_mouse_reporting_sgr_mode(vt); break; @@ -3066,10 +3069,6 @@ static void vt100_parser_handle_sm(VT100Screen *vt, char *buf, size_t len) break; case 12: // blinking cursor // not interested in blinking cursors - case 1005: // UTF-8 mouse tracking mode - // will just default this to always on. might break some - // programs, but the programs that will break will already be - // broken for terms with width greater than 223. case 1034: // interpret Meta key // not actually sure if ignoring this is correct - need to see // what exactly it does. don't think it's important though. @@ -3131,8 +3130,9 @@ static void vt100_parser_handle_rm(VT100Screen *vt, char *buf, size_t len) case 1003: vt100_screen_reset_mouse_reporting_any_motion(vt); break; + case 1005: case 1006: - vt100_screen_reset_mouse_reporting_sgr_mode(vt); + vt100_screen_set_mouse_reporting_normal_mode(vt); break; case 47: case 1049: @@ -3143,10 +3143,6 @@ static void vt100_parser_handle_rm(VT100Screen *vt, char *buf, size_t len) break; case 12: // blinking cursor // not interested in blinking cursors - case 1005: // UTF-8 mouse tracking mode - // will just default this to always on. might break some - // programs, but the programs that will break will already be - // broken for terms with width greater than 223. case 1034: // interpret Meta key // not actually sure if ignoring this is correct - need to see // what exactly it does. don't think it's important though. diff --git a/src/parser.l b/src/parser.l index 5c0452c..aefd81b 100644 --- a/src/parser.l +++ b/src/parser.l @@ -328,13 +328,13 @@ static void vt100_parser_handle_ris(VT100Screen *vt) vt100_screen_save_cursor(vt); vt100_screen_reset_text_attributes(vt); vt100_screen_show_cursor(vt); + vt100_screen_set_mouse_reporting_normal_mode(vt); vt100_screen_reset_application_keypad(vt); vt100_screen_reset_application_cursor(vt); vt100_screen_reset_mouse_reporting_press(vt); vt100_screen_reset_mouse_reporting_press_release(vt); vt100_screen_reset_mouse_reporting_button_motion(vt); vt100_screen_reset_mouse_reporting_any_motion(vt); - vt100_screen_reset_mouse_reporting_sgr_mode(vt); vt100_screen_reset_bracketed_paste(vt); vt100_screen_reset_origin_mode(vt); } @@ -659,6 +659,9 @@ static void vt100_parser_handle_sm(VT100Screen *vt, char *buf, size_t len) case 1003: vt100_screen_set_mouse_reporting_any_motion(vt); break; + case 1005: + vt100_screen_set_mouse_reporting_utf8_mode(vt); + break; case 1006: vt100_screen_set_mouse_reporting_sgr_mode(vt); break; @@ -671,10 +674,6 @@ static void vt100_parser_handle_sm(VT100Screen *vt, char *buf, size_t len) break; case 12: // blinking cursor // not interested in blinking cursors - case 1005: // UTF-8 mouse tracking mode - // will just default this to always on. might break some - // programs, but the programs that will break will already be - // broken for terms with width greater than 223. case 1034: // interpret Meta key // not actually sure if ignoring this is correct - need to see // what exactly it does. don't think it's important though. @@ -736,8 +735,9 @@ static void vt100_parser_handle_rm(VT100Screen *vt, char *buf, size_t len) case 1003: vt100_screen_reset_mouse_reporting_any_motion(vt); break; + case 1005: case 1006: - vt100_screen_reset_mouse_reporting_sgr_mode(vt); + vt100_screen_set_mouse_reporting_normal_mode(vt); break; case 47: case 1049: @@ -748,10 +748,6 @@ static void vt100_parser_handle_rm(VT100Screen *vt, char *buf, size_t len) break; case 12: // blinking cursor // not interested in blinking cursors - case 1005: // UTF-8 mouse tracking mode - // will just default this to always on. might break some - // programs, but the programs that will break will already be - // broken for terms with width greater than 223. case 1034: // interpret Meta key // not actually sure if ignoring this is correct - need to see // what exactly it does. don't think it's important though. diff --git a/src/screen.c b/src/screen.c index 0121124..c471ebd 100644 --- a/src/screen.c +++ b/src/screen.c @@ -832,14 +832,19 @@ void vt100_screen_reset_mouse_reporting_any_motion(VT100Screen *vt) vt->mouse_reporting_any_motion = 0; } -void vt100_screen_set_mouse_reporting_sgr_mode(VT100Screen *vt) +void vt100_screen_set_mouse_reporting_normal_mode(VT100Screen *vt) { - vt->mouse_reporting_sgr_mode = 1; + vt->mouse_reporting_mode = VT100_MOUSEREPORTING_NORMAL; } -void vt100_screen_reset_mouse_reporting_sgr_mode(VT100Screen *vt) +void vt100_screen_set_mouse_reporting_utf8_mode(VT100Screen *vt) +{ + vt->mouse_reporting_mode = VT100_MOUSEREPORTING_UTF8; +} + +void vt100_screen_set_mouse_reporting_sgr_mode(VT100Screen *vt) { - vt->mouse_reporting_sgr_mode = 0; + vt->mouse_reporting_mode = VT100_MOUSEREPORTING_SGR; } int vt100_screen_mouse_reporting_wants_button_press(VT100Screen *vt) diff --git a/src/screen.h b/src/screen.h index 2f1be62..cea9205 100644 --- a/src/screen.h +++ b/src/screen.h @@ -10,6 +10,12 @@ enum VT100ColorType { VT100_COLOR_RGB }; +enum VT100MouseReportingModeType { + VT100_MOUSEREPORTING_NORMAL, + VT100_MOUSEREPORTING_UTF8, + VT100_MOUSEREPORTING_SGR +}; + struct vt100_loc { int row; int col; @@ -78,16 +84,18 @@ struct vt100_screen { struct vt100_grid *grid; struct vt100_grid *alternate; + struct vt100_parser_state *parser_state; + char *title; size_t title_len; char *icon_name; size_t icon_name_len; - struct vt100_cell_attrs attrs; - int scrollback_length; - struct vt100_parser_state *parser_state; + struct vt100_cell_attrs attrs; + + unsigned char mouse_reporting_mode; unsigned int hide_cursor: 1; unsigned int application_keypad: 1; @@ -96,7 +104,6 @@ struct vt100_screen { unsigned int mouse_reporting_press_release: 1; unsigned int mouse_reporting_button_motion: 1; unsigned int mouse_reporting_any_motion: 1; - unsigned int mouse_reporting_sgr_mode: 1; unsigned int bracketed_paste: 1; unsigned int origin_mode: 1; @@ -178,8 +185,9 @@ void vt100_screen_set_mouse_reporting_button_motion(VT100Screen *vt); void vt100_screen_reset_mouse_reporting_button_motion(VT100Screen *vt); void vt100_screen_set_mouse_reporting_any_motion(VT100Screen *vt); void vt100_screen_reset_mouse_reporting_any_motion(VT100Screen *vt); +void vt100_screen_set_mouse_reporting_normal_mode(VT100Screen *vt); +void vt100_screen_set_mouse_reporting_utf8_mode(VT100Screen *vt); void vt100_screen_set_mouse_reporting_sgr_mode(VT100Screen *vt); -void vt100_screen_reset_mouse_reporting_sgr_mode(VT100Screen *vt); int vt100_screen_mouse_reporting_wants_button_press(VT100Screen *vt); int vt100_screen_mouse_reporting_wants_button_release(VT100Screen *vt); int vt100_screen_mouse_reporting_wants_button_motion(VT100Screen *vt); -- cgit v1.2.3