input: recognize some escape sequences for <Shift+Delete>
Also, hard-bind <Shift+Delete> in the same way as <Backspace>. This fixes https://savannah.gnu.org/bugs/?54948, and fixes https://savannah.gnu.org/bugs/?54975.
Этот коммит содержится в:
родитель
7ee07af081
Коммит
f55a3fabef
@ -1093,6 +1093,7 @@ void shortcut_init(void)
|
|||||||
add_to_sclist(MMOST, "Enter", KEY_ENTER, do_enter, 0);
|
add_to_sclist(MMOST, "Enter", KEY_ENTER, do_enter, 0);
|
||||||
add_to_sclist(MMOST, "^H", 0, do_backspace, 0);
|
add_to_sclist(MMOST, "^H", 0, do_backspace, 0);
|
||||||
add_to_sclist(MMOST, "Bsp", KEY_BACKSPACE, do_backspace, 0);
|
add_to_sclist(MMOST, "Bsp", KEY_BACKSPACE, do_backspace, 0);
|
||||||
|
add_to_sclist(MMOST, "Sh-Del", SHIFT_DELETE, do_backspace, 0);
|
||||||
add_to_sclist(MMOST, "^D", 0, do_delete, 0);
|
add_to_sclist(MMOST, "^D", 0, do_delete, 0);
|
||||||
add_to_sclist(MMOST, "Del", 0, do_delete, 0);
|
add_to_sclist(MMOST, "Del", 0, do_delete, 0);
|
||||||
/* Make ASCII DEL do a delete when requested, otherwise a backspace. */
|
/* Make ASCII DEL do a delete when requested, otherwise a backspace. */
|
||||||
@ -1128,6 +1129,7 @@ void shortcut_init(void)
|
|||||||
add_to_sclist(MMAIN, "M-G", 0, do_gotolinecolumn_void, 0);
|
add_to_sclist(MMAIN, "M-G", 0, do_gotolinecolumn_void, 0);
|
||||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^Y", 0, do_page_up, 0);
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^Y", 0, do_page_up, 0);
|
||||||
add_to_sclist(MHELP|MBROWSER, "Bsp", KEY_BACKSPACE, do_page_up, 0);
|
add_to_sclist(MHELP|MBROWSER, "Bsp", KEY_BACKSPACE, do_page_up, 0);
|
||||||
|
add_to_sclist(MHELP|MBROWSER, "Sh-Del", SHIFT_DELETE, do_page_up, 0);
|
||||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgUp", KEY_PPAGE, do_page_up, 0);
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgUp", KEY_PPAGE, do_page_up, 0);
|
||||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^V", 0, do_page_down, 0);
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^V", 0, do_page_down, 0);
|
||||||
add_to_sclist(MHELP|MBROWSER, "Space", 0x20, do_page_down, 0);
|
add_to_sclist(MHELP|MBROWSER, "Space", 0x20, do_page_down, 0);
|
||||||
|
@ -607,6 +607,7 @@ enum
|
|||||||
#define SHIFT_END 0x456
|
#define SHIFT_END 0x456
|
||||||
#define SHIFT_PAGEUP 0x457
|
#define SHIFT_PAGEUP 0x457
|
||||||
#define SHIFT_PAGEDOWN 0x458
|
#define SHIFT_PAGEDOWN 0x458
|
||||||
|
#define SHIFT_DELETE 0x45D
|
||||||
#define SHIFT_TAB 0x45F
|
#define SHIFT_TAB 0x45F
|
||||||
|
|
||||||
#ifdef USE_SLANG
|
#ifdef USE_SLANG
|
||||||
|
13
src/winio.c
13
src/winio.c
@ -602,6 +602,9 @@ int parse_kbinput(WINDOW *win)
|
|||||||
return SHIFT_TAB;
|
return SHIFT_TAB;
|
||||||
shift_held = TRUE;
|
shift_held = TRUE;
|
||||||
}
|
}
|
||||||
|
/* Is Shift being held while Delete is pressed? */
|
||||||
|
if (modifiers == 0x01 && retval == KEY_DC)
|
||||||
|
return SHIFT_DELETE;
|
||||||
/* Are Ctrl and Shift being held while Delete is pressed? */
|
/* Are Ctrl and Shift being held while Delete is pressed? */
|
||||||
if (modifiers == 0x05 && retval == KEY_DC)
|
if (modifiers == 0x05 && retval == KEY_DC)
|
||||||
return CONTROL_SHIFT_DELETE;
|
return CONTROL_SHIFT_DELETE;
|
||||||
@ -722,8 +725,8 @@ int parse_kbinput(WINDOW *win)
|
|||||||
case KEY_C3: /* PageDown (3) on keypad with NumLock off. */
|
case KEY_C3: /* PageDown (3) on keypad with NumLock off. */
|
||||||
return KEY_NPAGE;
|
return KEY_NPAGE;
|
||||||
#ifdef KEY_SDC /* Slang doesn't support KEY_SDC. */
|
#ifdef KEY_SDC /* Slang doesn't support KEY_SDC. */
|
||||||
case KEY_SDC: /* Make a shifted <Del> key do a backspace. */
|
case KEY_SDC:
|
||||||
return KEY_BACKSPACE;
|
return SHIFT_DELETE;
|
||||||
#endif
|
#endif
|
||||||
#ifdef KEY_SIC /* Slang doesn't support KEY_SIC. */
|
#ifdef KEY_SIC /* Slang doesn't support KEY_SIC. */
|
||||||
case KEY_SIC:
|
case KEY_SIC:
|
||||||
@ -1109,6 +1112,9 @@ int convert_sequence(const int *seq, size_t length, int *consumed)
|
|||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (length > 4 && seq[2] == ';' && seq[4] == '~') {
|
if (length > 4 && seq[2] == ';' && seq[4] == '~') {
|
||||||
*consumed = 5;
|
*consumed = 5;
|
||||||
|
if (seq[3] == '2')
|
||||||
|
/* Esc [ 3 ; 2 ~ == Shift-Delete on xterm/Terminal. */
|
||||||
|
return SHIFT_DELETE;
|
||||||
if (seq[3] == '3')
|
if (seq[3] == '3')
|
||||||
/* Esc [ 3 ; 3 ~ == Alt-Delete on xterm/rxvt/Eterm/Terminal. */
|
/* Esc [ 3 ; 3 ~ == Alt-Delete on xterm/rxvt/Eterm/Terminal. */
|
||||||
return ALT_DELETE;
|
return ALT_DELETE;
|
||||||
@ -1119,6 +1125,9 @@ int convert_sequence(const int *seq, size_t length, int *consumed)
|
|||||||
/* Esc [ 3 ; 6 ~ == Ctrl-Shift-Delete on xterm. */
|
/* Esc [ 3 ; 6 ~ == Ctrl-Shift-Delete on xterm. */
|
||||||
return controlshiftdelete;
|
return controlshiftdelete;
|
||||||
}
|
}
|
||||||
|
if (length > 2 && seq[2] == '$')
|
||||||
|
/* Esc [ 3 $ == Shift-Delete on urxvt. */
|
||||||
|
return SHIFT_DELETE;
|
||||||
if (length > 2 && seq[2] == '^')
|
if (length > 2 && seq[2] == '^')
|
||||||
/* Esc [ 3 ^ == Ctrl-Delete on urxvt. */
|
/* Esc [ 3 ^ == Ctrl-Delete on urxvt. */
|
||||||
return CONTROL_DELETE;
|
return CONTROL_DELETE;
|
||||||
|
@ -5,7 +5,7 @@ syntax nanohelp
|
|||||||
|
|
||||||
# Key combos:
|
# Key combos:
|
||||||
color cyan "\^[]4-8A-Z^\_◀▶▲▼]" "[◀▶▲▼]" "\<M-." "\<F1?[0-9]"
|
color cyan "\^[]4-8A-Z^\_◀▶▲▼]" "[◀▶▲▼]" "\<M-." "\<F1?[0-9]"
|
||||||
color cyan "\<(Tab|Sh-Tab|Enter|Ins|Del|Sh-\^Del|Space|Bsp|Up|Down|Left|Right|Home|End|PgUp|PgDn)\>"
|
color cyan "\<(Tab|Sh-Tab|Enter|Ins|Del|Sh-\^?Del|Space|Bsp|Up|Down|Left|Right|Home|End|PgUp|PgDn)\>"
|
||||||
|
|
||||||
# Quoted indicators:
|
# Quoted indicators:
|
||||||
color brightred "'(\^|M-)'"
|
color brightred "'(\^|M-)'"
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user