Fix arrow handling after fixing mouse clicking glitches ##cons

This commit is contained in:
pancake 2021-07-27 11:25:47 +02:00
parent b552322004
commit 39993b39d7

View File

@ -1696,19 +1696,6 @@ R_API const char *r_line_readline_cb(RLineReadCallback cb, void *user) {
I.buffer.index = I.buffer.length; I.buffer.index = I.buffer.length;
} }
break; break;
case '[': // mouse click event
// read until M
for (;;) {
ch = r_cons_readchar ();
if (ch == -1) {
r_cons_break_pop ();
return NULL;
}
if (ch == 'M') {
break;
}
}
break;
default: default:
if (I.vtmode == 2) { if (I.vtmode == 2) {
buf[1] = r_cons_readchar_timeout (50); buf[1] = r_cons_readchar_timeout (50);
@ -1717,10 +1704,12 @@ R_API const char *r_line_readline_cb(RLineReadCallback cb, void *user) {
__print_prompt (); __print_prompt ();
continue; continue;
} }
} else {
buf[1] = r_cons_readchar_timeout (50);
} }
if (buf[0] == 0x5b) { // [ if (buf[0] == '[') { // [
switch (buf[1]) { switch (buf[1]) {
case '3': // supr case '3': // supr or mouse click
__delete_next_char (); __delete_next_char ();
if (I.vtmode == 2) { if (I.vtmode == 2) {
buf[1] = r_cons_readchar (); buf[1] = r_cons_readchar ();
@ -1729,6 +1718,16 @@ R_API const char *r_line_readline_cb(RLineReadCallback cb, void *user) {
return NULL; return NULL;
} }
} }
for (;;) {
ch = r_cons_readchar ();
if (ch == -1) {
r_cons_break_pop ();
return NULL;
}
if (isupper (ch)) { // read until 'M'
break;
}
}
break; break;
case '5': // pag up case '5': // pag up
if (I.vtmode == 2) { if (I.vtmode == 2) {