mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
[kbd] ui.double_esc option, based on PLD patch
This commit is contained in:
parent
6d4a573571
commit
09e6fb59da
@ -1524,6 +1524,10 @@ static union option_info config_options_info[] = {
|
|||||||
"back_to_exit", 0, 0,
|
"back_to_exit", 0, 0,
|
||||||
N_("Going back from initial page exits tab or elinks.")),
|
N_("Going back from initial page exits tab or elinks.")),
|
||||||
|
|
||||||
|
INIT_OPT_BOOL("ui", N_("Double ESC"),
|
||||||
|
"double_esc", 0, 0,
|
||||||
|
N_("Back to 0.12pre5 handling of ESC key.")),
|
||||||
|
|
||||||
INIT_OPT_BOOL("ui", N_("Set window title"),
|
INIT_OPT_BOOL("ui", N_("Set window title"),
|
||||||
"window_title", 0, 1,
|
"window_title", 0, 1,
|
||||||
N_("Set the window title when running in a windowing "
|
N_("Set the window title when running in a windowing "
|
||||||
|
@ -789,6 +789,11 @@ decode_terminal_escape_sequence(struct itrm *itrm, struct interlink_event *ev)
|
|||||||
int v;
|
int v;
|
||||||
int el;
|
int el;
|
||||||
|
|
||||||
|
if (itrm->in.queue.len == 2 && itrm->in.queue.data[1] == ASCII_ESC && get_opt_bool("ui.double_esc", NULL)) {
|
||||||
|
kbd.key = KBD_ESC;
|
||||||
|
set_kbd_interlink_event(ev, kbd.key, kbd.modifier);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
if (itrm->in.queue.len < 3) return -1;
|
if (itrm->in.queue.len < 3) return -1;
|
||||||
|
|
||||||
if (itrm->in.queue.data[2] == '[') {
|
if (itrm->in.queue.data[2] == '[') {
|
||||||
@ -1136,8 +1141,12 @@ process_queue(struct itrm *itrm)
|
|||||||
* beginning of e.g. ESC ESC 0x5B 0x41,
|
* beginning of e.g. ESC ESC 0x5B 0x41,
|
||||||
* which we should parse as Esc Up. */
|
* which we should parse as Esc Up. */
|
||||||
if (itrm->in.queue.len < 3) {
|
if (itrm->in.queue.len < 3) {
|
||||||
|
if (get_opt_bool("ui.double_esc", NULL)) {
|
||||||
|
el = decode_terminal_escape_sequence(itrm, &ev);
|
||||||
|
} else {
|
||||||
/* Need more data to figure it out. */
|
/* Need more data to figure it out. */
|
||||||
el = -1;
|
el = -1;
|
||||||
|
}
|
||||||
} else if (itrm->in.queue.data[2] == 0x5B
|
} else if (itrm->in.queue.data[2] == 0x5B
|
||||||
|| itrm->in.queue.data[2] == 0x4F) {
|
|| itrm->in.queue.data[2] == 0x4F) {
|
||||||
/* The first ESC appears to be followed
|
/* The first ESC appears to be followed
|
||||||
|
Loading…
Reference in New Issue
Block a user