bindings: make the Shift+arrow keys work by default on more terminals
Ask ncurses for the codes for the Shift+arrow keys, so that also <Shift+Up> and <Shift+Down> can be recognized, for which ncurses doesn't have standard codes. This fixes https://savannah.gnu.org/bugs/?54790. Reported-by: Javier Valencia <javiervalencia80@gmail.com>master
parent
8bffc8ea53
commit
826be439db
|
@ -71,6 +71,7 @@ int didfind = 0;
|
||||||
int controlleft, controlright, controlup, controldown, controlhome, controlend;
|
int controlleft, controlright, controlup, controldown, controlhome, controlend;
|
||||||
int controldelete, controlshiftdelete;
|
int controldelete, controlshiftdelete;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
int shiftleft, shiftright, shiftup, shiftdown;
|
||||||
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
|
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
|
||||||
int shiftcontrolhome, shiftcontrolend;
|
int shiftcontrolhome, shiftcontrolend;
|
||||||
int altleft, altright, altup, altdown;
|
int altleft, altright, altup, altdown;
|
||||||
|
|
|
@ -2579,6 +2579,11 @@ int main(int argc, char **argv)
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
controldelete = get_keycode("kDC5", CONTROL_DELETE);
|
controldelete = get_keycode("kDC5", CONTROL_DELETE);
|
||||||
controlshiftdelete = get_keycode("kDC6", CONTROL_SHIFT_DELETE);
|
controlshiftdelete = get_keycode("kDC6", CONTROL_SHIFT_DELETE);
|
||||||
|
/* Ask for the codes for Shift+Left/Right/Up/Down. */
|
||||||
|
shiftleft = get_keycode("kLFT", SHIFT_LEFT);
|
||||||
|
shiftright = get_keycode("kRIT", SHIFT_RIGHT);
|
||||||
|
shiftup = get_keycode("kUP", SHIFT_UP);
|
||||||
|
shiftdown = get_keycode("kDN", SHIFT_DOWN);
|
||||||
/* Ask for the codes for Shift+Control+Left/Right/Up/Down. */
|
/* Ask for the codes for Shift+Control+Left/Right/Up/Down. */
|
||||||
shiftcontrolleft = get_keycode("kLFT6", SHIFT_CONTROL_LEFT);
|
shiftcontrolleft = get_keycode("kLFT6", SHIFT_CONTROL_LEFT);
|
||||||
shiftcontrolright = get_keycode("kRIT6", SHIFT_CONTROL_RIGHT);
|
shiftcontrolright = get_keycode("kRIT6", SHIFT_CONTROL_RIGHT);
|
||||||
|
|
|
@ -597,6 +597,10 @@ enum
|
||||||
#define SHIFT_ALT_RIGHT 0x432
|
#define SHIFT_ALT_RIGHT 0x432
|
||||||
#define SHIFT_ALT_UP 0x433
|
#define SHIFT_ALT_UP 0x433
|
||||||
#define SHIFT_ALT_DOWN 0x434
|
#define SHIFT_ALT_DOWN 0x434
|
||||||
|
#define SHIFT_LEFT 0x451
|
||||||
|
#define SHIFT_RIGHT 0x452
|
||||||
|
#define SHIFT_UP 0x453
|
||||||
|
#define SHIFT_DOWN 0x454
|
||||||
#define SHIFT_HOME 0x455
|
#define SHIFT_HOME 0x455
|
||||||
#define SHIFT_END 0x456
|
#define SHIFT_END 0x456
|
||||||
#define SHIFT_PAGEUP 0x457
|
#define SHIFT_PAGEUP 0x457
|
||||||
|
|
|
@ -64,6 +64,10 @@ extern int controlend;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
extern int controldelete;
|
extern int controldelete;
|
||||||
extern int controlshiftdelete;
|
extern int controlshiftdelete;
|
||||||
|
extern int shiftleft;
|
||||||
|
extern int shiftright;
|
||||||
|
extern int shiftup;
|
||||||
|
extern int shiftdown;
|
||||||
extern int shiftcontrolleft;
|
extern int shiftcontrolleft;
|
||||||
extern int shiftcontrolright;
|
extern int shiftcontrolright;
|
||||||
extern int shiftcontrolup;
|
extern int shiftcontrolup;
|
||||||
|
|
14
src/winio.c
14
src/winio.c
|
@ -543,7 +543,19 @@ int parse_kbinput(WINDOW *win)
|
||||||
return CONTROL_DELETE;
|
return CONTROL_DELETE;
|
||||||
else if (retval == controlshiftdelete)
|
else if (retval == controlshiftdelete)
|
||||||
return CONTROL_SHIFT_DELETE;
|
return CONTROL_SHIFT_DELETE;
|
||||||
else if (retval == shiftcontrolleft) {
|
else if (retval == shiftleft) {
|
||||||
|
shift_held = TRUE;
|
||||||
|
return KEY_LEFT;
|
||||||
|
} else if (retval == shiftright) {
|
||||||
|
shift_held = TRUE;
|
||||||
|
return KEY_RIGHT;
|
||||||
|
} else if (retval == shiftup) {
|
||||||
|
shift_held = TRUE;
|
||||||
|
return KEY_UP;
|
||||||
|
} else if (retval == shiftdown) {
|
||||||
|
shift_held = TRUE;
|
||||||
|
return KEY_DOWN;
|
||||||
|
} else if (retval == shiftcontrolleft) {
|
||||||
shift_held = TRUE;
|
shift_held = TRUE;
|
||||||
return CONTROL_LEFT;
|
return CONTROL_LEFT;
|
||||||
} else if (retval == shiftcontrolright) {
|
} else if (retval == shiftcontrolright) {
|
||||||
|
|
Loading…
Reference in New Issue