fix parser bug with bell & broken mouse tracking sgr reporting for movement with button
This commit is contained in:
@@ -1158,7 +1158,7 @@ body.term #content {
|
|||||||
padding: 6px;
|
padding: 6px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
border: 2px solid #3983CD;
|
border: 2px solid #3983CD;
|
||||||
font-size: 24px;
|
font-size: 20px;
|
||||||
font-family: "DejaVu Sans Mono", "Liberation Mono", "Inconsolata", monospace; }
|
font-family: "DejaVu Sans Mono", "Liberation Mono", "Inconsolata", monospace; }
|
||||||
#screen span {
|
#screen span {
|
||||||
white-space: pre; }
|
white-space: pre; }
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ body.term {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
border: 2px solid #3983CD;
|
border: 2px solid #3983CD;
|
||||||
|
|
||||||
font-size: 24px; // some font heights cause visual glitches with some font renderers. This should be configurable.
|
font-size: 20px; // some font heights cause visual glitches with some font renderers. This should be configurable.
|
||||||
font-family: $screen-stack;
|
font-family: $screen-stack;
|
||||||
|
|
||||||
span {
|
span {
|
||||||
|
|||||||
+1
-1
@@ -167,7 +167,7 @@ ansi_parser(char newchar)
|
|||||||
case BEL:
|
case BEL:
|
||||||
// bel is also used to terminate OSC
|
// bel is also used to terminate OSC
|
||||||
apars_handle_bel();
|
apars_handle_bel();
|
||||||
break;
|
return;
|
||||||
|
|
||||||
case ENQ:
|
case ENQ:
|
||||||
apars_handle_enq();
|
apars_handle_enq();
|
||||||
|
|||||||
+1
-1
@@ -136,7 +136,7 @@ ansi_parser(char newchar)
|
|||||||
case BEL:
|
case BEL:
|
||||||
// bel is also used to terminate OSC
|
// bel is also used to terminate OSC
|
||||||
apars_handle_bel();
|
apars_handle_bel();
|
||||||
break;
|
return;
|
||||||
|
|
||||||
case ENQ:
|
case ENQ:
|
||||||
apars_handle_enq();
|
apars_handle_enq();
|
||||||
|
|||||||
+4
-2
@@ -265,6 +265,7 @@ apars_handle_csi(char leadchar, const int *params, int count, char keychar)
|
|||||||
else if (leadchar == '?') {
|
else if (leadchar == '?') {
|
||||||
// Save private attributes (CSI ? Pm h/l)
|
// Save private attributes (CSI ? Pm h/l)
|
||||||
ansi_noimpl("Save private attrs");
|
ansi_noimpl("Save private attrs");
|
||||||
|
apars_show_context();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// other:
|
// other:
|
||||||
@@ -281,6 +282,7 @@ apars_handle_csi(char leadchar, const int *params, int count, char keychar)
|
|||||||
else if (leadchar == '?') {
|
else if (leadchar == '?') {
|
||||||
// Restore private attributes (CSI ? Pm h/l)
|
// Restore private attributes (CSI ? Pm h/l)
|
||||||
ansi_noimpl("Restore private attrs");
|
ansi_noimpl("Restore private attrs");
|
||||||
|
apars_show_context();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// other:
|
// other:
|
||||||
@@ -460,7 +462,6 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts)
|
|||||||
// 1004 - Send FocusIn/FocusOut events
|
// 1004 - Send FocusIn/FocusOut events
|
||||||
// 1005 - Enable UTF-8 Mouse Mode - we implement this as an alias to X10 mode
|
// 1005 - Enable UTF-8 Mouse Mode - we implement this as an alias to X10 mode
|
||||||
// 1006 - SGR mouse mode
|
// 1006 - SGR mouse mode
|
||||||
|
|
||||||
if (n == 9) mouse_tracking.mode = yn ? MTM_X10 : MTM_NONE;
|
if (n == 9) mouse_tracking.mode = yn ? MTM_X10 : MTM_NONE;
|
||||||
else if (n == 1000) mouse_tracking.mode = yn ? MTM_NORMAL : MTM_NONE;
|
else if (n == 1000) mouse_tracking.mode = yn ? MTM_NORMAL : MTM_NONE;
|
||||||
else if (n == 1002) mouse_tracking.mode = yn ? MTM_BUTTON_MOTION : MTM_NONE;
|
else if (n == 1002) mouse_tracking.mode = yn ? MTM_BUTTON_MOTION : MTM_NONE;
|
||||||
@@ -469,6 +470,7 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts)
|
|||||||
else if (n == 1005) mouse_tracking.encoding = yn ? MTE_UTF8 : MTE_SIMPLE;
|
else if (n == 1005) mouse_tracking.encoding = yn ? MTE_UTF8 : MTE_SIMPLE;
|
||||||
else if (n == 1006) mouse_tracking.encoding = yn ? MTE_SGR : MTE_SIMPLE;
|
else if (n == 1006) mouse_tracking.encoding = yn ? MTE_SGR : MTE_SIMPLE;
|
||||||
else if (n == 1015) mouse_tracking.encoding = yn ? MTE_URXVT : MTE_SIMPLE;
|
else if (n == 1015) mouse_tracking.encoding = yn ? MTE_URXVT : MTE_SIMPLE;
|
||||||
|
dbg("Mouse mode=%d, enc=%d, foctr=%d", mouse_tracking.mode, mouse_tracking.encoding, mouse_tracking.focus_tracking);
|
||||||
}
|
}
|
||||||
else if (n == 12) {
|
else if (n == 12) {
|
||||||
// TODO Cursor blink on/off
|
// TODO Cursor blink on/off
|
||||||
@@ -552,7 +554,7 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts)
|
|||||||
if (n == 4) {
|
if (n == 4) {
|
||||||
screen_set_insert_mode(yn);
|
screen_set_insert_mode(yn);
|
||||||
}
|
}
|
||||||
if (n == 12) {
|
else if (n == 12) {
|
||||||
// SRM is inverted, according to vt510 manual
|
// SRM is inverted, according to vt510 manual
|
||||||
termconf_scratch.loopback = !yn;
|
termconf_scratch.loopback = !yn;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -199,7 +199,7 @@ void ICACHE_FLASH_ATTR sendMouseAction(char evt, int y, int x, int button, u8 mo
|
|||||||
sprintf(buf, "\x1b[M%c%c%c", (u8)(32+eventcode), (u8)(32+x), (u8)(32+y));
|
sprintf(buf, "\x1b[M%c%c%c", (u8)(32+eventcode), (u8)(32+x), (u8)(32+y));
|
||||||
}
|
}
|
||||||
else if (mte == MTE_SGR) {
|
else if (mte == MTE_SGR) {
|
||||||
sprintf(buf, "\x1b[<%d;%d;%d%c", eventcode, x, y, evt == 'p' ? 'M' : 'm');
|
sprintf(buf, "\x1b[<%d;%d;%d%c", eventcode, x, y, (evt == 'p'||(evt=='m'&&button>0)) ? 'M' : 'm');
|
||||||
}
|
}
|
||||||
else if (mte == MTE_URXVT) {
|
else if (mte == MTE_URXVT) {
|
||||||
sprintf(buf, "\x1b[%d;%d;%dM", (u8)(32+eventcode), (u8)(32+x), (u8)(32+y));
|
sprintf(buf, "\x1b[%d;%d;%dM", (u8)(32+eventcode), (u8)(32+x), (u8)(32+y));
|
||||||
|
|||||||
+16
-14
@@ -50,11 +50,11 @@ static u32 tab_stops[TABSTOP_WORDS];
|
|||||||
* Screen state structure
|
* Screen state structure
|
||||||
*/
|
*/
|
||||||
static struct {
|
static struct {
|
||||||
bool numpad_alt_mode; //!< Application Mode - affects how user input of control keys is sent
|
bool numpad_alt_mode; //!< DECNKM - Numpad Application Mode
|
||||||
bool cursors_alt_mode; //!< Application mode for cursor keys
|
bool cursors_alt_mode; //!< DECCKM - Cursors Application mode
|
||||||
|
|
||||||
bool newline_mode; // LNM - CR automatically sends LF
|
bool newline_mode; //!< LNM - CR automatically sends LF
|
||||||
bool reverse;
|
bool reverse; //!< DECSCNM - Reverse video
|
||||||
|
|
||||||
// Vertical margin bounds (inclusive start/end of scrolling region)
|
// Vertical margin bounds (inclusive start/end of scrolling region)
|
||||||
int vm0;
|
int vm0;
|
||||||
@@ -66,27 +66,30 @@ static struct {
|
|||||||
#define RH (scr.vm1 - scr.vm0 + 1)
|
#define RH (scr.vm1 - scr.vm0 + 1)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
/* Cursor position */
|
||||||
int x; //!< X coordinate
|
int x; //!< X coordinate
|
||||||
int y; //!< Y coordinate
|
int y; //!< Y coordinate
|
||||||
bool hanging; //!< xenl state - cursor half-wrapped
|
bool hanging; //!< xenl state - cursor half-wrapped
|
||||||
|
|
||||||
// SGR
|
/* SGR */
|
||||||
bool inverse; //!< not in attrs bc it's applied server-side (not sent to browser)
|
bool inverse; //!< not in attrs bc it's applied server-side (not sent to browser)
|
||||||
u8 attrs;
|
u8 attrs;
|
||||||
Color fg; //!< Foreground color for writing
|
Color fg; //!< Foreground color for writing
|
||||||
Color bg; //!< Background color for writing
|
Color bg; //!< Background color for writing
|
||||||
|
|
||||||
// Other attribs
|
// Other attribs
|
||||||
|
|
||||||
|
/* Character set */
|
||||||
int charsetN;
|
int charsetN;
|
||||||
char charset0;
|
char charset0;
|
||||||
char charset1;
|
char charset1;
|
||||||
bool wraparound; //!< Wrapping when EOL
|
|
||||||
bool origin_mode; // DECOM - absolute positioning is relative to vertical margins
|
|
||||||
bool selective_erase; // TODO implement
|
|
||||||
|
|
||||||
// Not saved/restored FIXME those should not be saved, but are (a bug?)
|
/** DEC private modes */
|
||||||
bool insert_mode; //!< Insert mode (move rest of the line to the right)
|
bool wraparound; //!< DECAWM - Wrapping when EOL
|
||||||
bool visible; //!< Visible (not attribute, DEC special)
|
bool origin_mode; //!< DECOM - absolute positioning is relative to vertical margins
|
||||||
|
|
||||||
|
bool insert_mode; //!< IRM - Insert mode (move rest of the line to the right)
|
||||||
|
bool visible; //!< DECTCEM - Cursor visible
|
||||||
} CursorTypeDef;
|
} CursorTypeDef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -245,7 +248,6 @@ cursor_reset(void)
|
|||||||
cursor.hanging = false;
|
cursor.hanging = false;
|
||||||
cursor.visible = true;
|
cursor.visible = true;
|
||||||
cursor.insert_mode = false;
|
cursor.insert_mode = false;
|
||||||
cursor.selective_erase = false;
|
|
||||||
cursor.origin_mode = false;
|
cursor.origin_mode = false;
|
||||||
|
|
||||||
cursor.charsetN = 0;
|
cursor.charsetN = 0;
|
||||||
@@ -1292,8 +1294,8 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, void **data)
|
|||||||
(scr.cursors_alt_mode ? 1<<2 : 0) |
|
(scr.cursors_alt_mode ? 1<<2 : 0) |
|
||||||
(scr.numpad_alt_mode ? 1<<3 : 0) |
|
(scr.numpad_alt_mode ? 1<<3 : 0) |
|
||||||
(termconf->fn_alt_mode ? 1<<4 : 0) |
|
(termconf->fn_alt_mode ? 1<<4 : 0) |
|
||||||
(mouse_tracking.mode!=MTM_NONE ? 1<<5 : 0) |
|
((mouse_tracking.mode>MTM_NONE) ? 1<<5 : 0) | // disables context menu
|
||||||
(mouse_tracking.mode>=MTM_BUTTON_MOTION ? 1<<6 : 0) |
|
((mouse_tracking.mode>=MTM_NORMAL) ? 1<<6 : 0) | // disables selecting
|
||||||
(termconf_scratch.show_buttons ? 1<<7 : 0) |
|
(termconf_scratch.show_buttons ? 1<<7 : 0) |
|
||||||
(termconf_scratch.show_config_links ? 1<<8 : 0)
|
(termconf_scratch.show_config_links ? 1<<8 : 0)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user