fix parser bug with bell & broken mouse tracking sgr reporting for movement with button

pull/111/merge
Ondřej Hruška 7 years ago
parent f693373a34
commit 3f198f8360
  1. 2
      html_orig/css/app.css
  2. 2
      html_orig/sass/pages/_term.scss
  3. 2
      user/ansi_parser.c
  4. 2
      user/ansi_parser.rl
  5. 6
      user/apars_csi.c
  6. 2
      user/cgi_sockets.c
  7. 30
      user/screen.c

@ -1158,7 +1158,7 @@ body.term #content {
padding: 6px;
display: inline-block;
border: 2px solid #3983CD;
font-size: 24px;
font-size: 20px;
font-family: "DejaVu Sans Mono", "Liberation Mono", "Inconsolata", monospace; }
#screen span {
white-space: pre; }

@ -22,7 +22,7 @@ body.term {
display: inline-block;
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;
span {

@ -167,7 +167,7 @@ ansi_parser(char newchar)
case BEL:
// bel is also used to terminate OSC
apars_handle_bel();
break;
return;
case ENQ:
apars_handle_enq();

@ -136,7 +136,7 @@ ansi_parser(char newchar)
case BEL:
// bel is also used to terminate OSC
apars_handle_bel();
break;
return;
case ENQ:
apars_handle_enq();

@ -265,6 +265,7 @@ apars_handle_csi(char leadchar, const int *params, int count, char keychar)
else if (leadchar == '?') {
// Save private attributes (CSI ? Pm h/l)
ansi_noimpl("Save private attrs");
apars_show_context();
}
else {
// other:
@ -281,6 +282,7 @@ apars_handle_csi(char leadchar, const int *params, int count, char keychar)
else if (leadchar == '?') {
// Restore private attributes (CSI ? Pm h/l)
ansi_noimpl("Restore private attrs");
apars_show_context();
}
else {
// other:
@ -460,7 +462,6 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts)
// 1004 - Send FocusIn/FocusOut events
// 1005 - Enable UTF-8 Mouse Mode - we implement this as an alias to X10 mode
// 1006 - SGR mouse mode
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 == 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 == 1006) mouse_tracking.encoding = yn ? MTE_SGR : 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) {
// TODO Cursor blink on/off
@ -552,7 +554,7 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts)
if (n == 4) {
screen_set_insert_mode(yn);
}
if (n == 12) {
else if (n == 12) {
// SRM is inverted, according to vt510 manual
termconf_scratch.loopback = !yn;
}

@ -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));
}
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) {
sprintf(buf, "\x1b[%d;%d;%dM", (u8)(32+eventcode), (u8)(32+x), (u8)(32+y));

@ -50,11 +50,11 @@ static u32 tab_stops[TABSTOP_WORDS];
* Screen state structure
*/
static struct {
bool numpad_alt_mode; //!< Application Mode - affects how user input of control keys is sent
bool cursors_alt_mode; //!< Application mode for cursor keys
bool numpad_alt_mode; //!< DECNKM - Numpad Application Mode
bool cursors_alt_mode; //!< DECCKM - Cursors Application mode
bool newline_mode; // LNM - CR automatically sends LF
bool reverse;
bool newline_mode; //!< LNM - CR automatically sends LF
bool reverse; //!< DECSCNM - Reverse video
// Vertical margin bounds (inclusive start/end of scrolling region)
int vm0;
@ -66,27 +66,30 @@ static struct {
#define RH (scr.vm1 - scr.vm0 + 1)
typedef struct {
/* Cursor position */
int x; //!< X coordinate
int y; //!< Y coordinate
bool hanging; //!< xenl state - cursor half-wrapped
// SGR
/* SGR */
bool inverse; //!< not in attrs bc it's applied server-side (not sent to browser)
u8 attrs;
Color fg; //!< Foreground color for writing
Color bg; //!< Background color for writing
// Other attribs
/* Character set */
int charsetN;
char charset0;
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?)
bool insert_mode; //!< Insert mode (move rest of the line to the right)
bool visible; //!< Visible (not attribute, DEC special)
/** DEC private modes */
bool wraparound; //!< DECAWM - Wrapping when EOL
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;
/**
@ -245,7 +248,6 @@ cursor_reset(void)
cursor.hanging = false;
cursor.visible = true;
cursor.insert_mode = false;
cursor.selective_erase = false;
cursor.origin_mode = false;
cursor.charsetN = 0;
@ -1292,8 +1294,8 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, void **data)
(scr.cursors_alt_mode ? 1<<2 : 0) |
(scr.numpad_alt_mode ? 1<<3 : 0) |
(termconf->fn_alt_mode ? 1<<4 : 0) |
(mouse_tracking.mode!=MTM_NONE ? 1<<5 : 0) |
(mouse_tracking.mode>=MTM_BUTTON_MOTION ? 1<<6 : 0) |
((mouse_tracking.mode>MTM_NONE) ? 1<<5 : 0) | // disables context menu
((mouse_tracking.mode>=MTM_NORMAL) ? 1<<6 : 0) | // disables selecting
(termconf_scratch.show_buttons ? 1<<7 : 0) |
(termconf_scratch.show_config_links ? 1<<8 : 0)
)

Loading…
Cancel
Save