mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 12:51:23 +03:00
bindings: add a dedicated keycode for <Tab> for when a region is marked
In this way the keycode cannot be unbound from the 'indent' function,
so pressing <Tab> on a marked region will always indent the region.
This fixes https://savannah.gnu.org/bugs/?56960.
Bug existed since the "tabbing" of a marked region was introduced,
in version 2.9.2, commit 09958ebd
.
This commit is contained in:
parent
cfd17f5722
commit
5103bfe6b8
@ -1146,7 +1146,7 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "M-6", 0, copy_text, 0);
|
||||
add_to_sclist(MMAIN, "M-^", 0, copy_text, 0);
|
||||
add_to_sclist(MMAIN, "M-}", 0, do_indent, 0);
|
||||
add_to_sclist(MMAIN, "Tab", TAB_CODE, do_indent, 0);
|
||||
add_to_sclist(MMAIN, "Tab", INDENT_KEY, do_indent, 0);
|
||||
add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0);
|
||||
add_to_sclist(MMAIN, "Sh-Tab", SHIFT_TAB, do_unindent, 0);
|
||||
add_to_sclist(MMAIN, "M-:", 0, record_macro, 0);
|
||||
|
@ -605,6 +605,9 @@ enum
|
||||
#define SHIFT_DELETE 0x45D
|
||||
#define SHIFT_TAB 0x45F
|
||||
|
||||
/* A special keycode for when <Tab> is pressed while the mark is on. */
|
||||
#define INDENT_KEY 0x4F1
|
||||
|
||||
#ifdef USE_SLANG
|
||||
#ifdef ENABLE_UTF8
|
||||
#define KEY_BAD 0xFF /* Clipped error code. */
|
||||
|
@ -658,12 +658,8 @@ int parse_kbinput(WINDOW *win)
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* When <Tab> is pressed while the mark is on, do an indent. */
|
||||
if (retval == TAB_CODE && openfile->mark && currmenu == MMAIN) {
|
||||
const keystruct *command = first_sc_for(MMAIN, do_indent);
|
||||
|
||||
meta_key = command->meta;
|
||||
return command->keycode;
|
||||
}
|
||||
if (retval == TAB_CODE && openfile->mark && currmenu == MMAIN)
|
||||
return INDENT_KEY;
|
||||
#endif
|
||||
|
||||
switch (retval) {
|
||||
|
Loading…
Reference in New Issue
Block a user