Making Ctrl-Left and Ctrl-Right produce special codes,
and mapping these codes to Prevword and Nextword. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5036 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
6f28d35eef
commit
09dd0a4acb
|
@ -1,5 +1,9 @@
|
||||||
2014-06-29 Benno Schulenberg <bensberg@justemail.net>
|
2014-06-29 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/rcfile.c: Fix compilation with --enable-tiny --enable-nanorc.
|
* src/rcfile.c: Fix compilation with --enable-tiny --enable-nanorc.
|
||||||
|
* src/winio.c (parse_kbinput, get_escape_seq_kbinput): Make Ctrl-Left
|
||||||
|
and Ctrl-Right produce special codes, and map these codes to Prevword
|
||||||
|
and Nextword instead of reducing them to a plain Left and Right. The
|
||||||
|
codes 539 and 554 were so chosen because some terminals produce these.
|
||||||
|
|
||||||
2014-06-29 Mark Majeres <mark@engine12.com>
|
2014-06-29 Mark Majeres <mark@engine12.com>
|
||||||
* src/text.c (do_undo): Update the pointer to the bottom of the file
|
* src/text.c (do_undo): Update the pointer to the bottom of the file
|
||||||
|
|
|
@ -563,6 +563,10 @@ enum
|
||||||
#define NANO_CONTROL_7 31
|
#define NANO_CONTROL_7 31
|
||||||
#define NANO_CONTROL_8 127
|
#define NANO_CONTROL_8 127
|
||||||
|
|
||||||
|
/* Codes for "modified" Arrow keys. Chosen like this because some
|
||||||
|
* terminals produce them, and they are beyond KEY_MAX of ncurses. */
|
||||||
|
#define CONTROL_LEFT 539
|
||||||
|
#define CONTROL_RIGHT 554
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Extra bits for the undo function. */
|
/* Extra bits for the undo function. */
|
||||||
|
|
38
src/winio.c
38
src/winio.c
|
@ -634,6 +634,16 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||||
retval = ERR;
|
retval = ERR;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case CONTROL_LEFT:
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
retval = sc_seq_or(do_prev_word_void, 0);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case CONTROL_RIGHT:
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
retval = sc_seq_or(do_next_word_void, 0);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If our result is an extended keypad value (i.e. a value
|
/* If our result is an extended keypad value (i.e. a value
|
||||||
|
@ -709,11 +719,15 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
* Terminal. */
|
* Terminal. */
|
||||||
case 'B': /* Esc O 1 ; 5 B == Ctrl-Down on
|
case 'B': /* Esc O 1 ; 5 B == Ctrl-Down on
|
||||||
* Terminal. */
|
* Terminal. */
|
||||||
|
retval = get_escape_seq_abcd(seq[4]);
|
||||||
|
break;
|
||||||
case 'C': /* Esc O 1 ; 5 C == Ctrl-Right on
|
case 'C': /* Esc O 1 ; 5 C == Ctrl-Right on
|
||||||
* Terminal. */
|
* Terminal. */
|
||||||
|
retval = CONTROL_RIGHT;
|
||||||
|
break;
|
||||||
case 'D': /* Esc O 1 ; 5 D == Ctrl-Left on
|
case 'D': /* Esc O 1 ; 5 D == Ctrl-Left on
|
||||||
* Terminal. */
|
* Terminal. */
|
||||||
retval = get_escape_seq_abcd(seq[4]);
|
retval = CONTROL_LEFT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,10 +820,14 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
break;
|
break;
|
||||||
case 'a': /* Esc O a == Ctrl-Up on rxvt. */
|
case 'a': /* Esc O a == Ctrl-Up on rxvt. */
|
||||||
case 'b': /* Esc O b == Ctrl-Down on rxvt. */
|
case 'b': /* Esc O b == Ctrl-Down on rxvt. */
|
||||||
case 'c': /* Esc O c == Ctrl-Right on rxvt. */
|
|
||||||
case 'd': /* Esc O d == Ctrl-Left on rxvt. */
|
|
||||||
retval = get_escape_seq_abcd(seq[1]);
|
retval = get_escape_seq_abcd(seq[1]);
|
||||||
break;
|
break;
|
||||||
|
case 'c': /* Esc O c == Ctrl-Right on rxvt. */
|
||||||
|
retval = CONTROL_RIGHT;
|
||||||
|
break;
|
||||||
|
case 'd': /* Esc O d == Ctrl-Left on rxvt. */
|
||||||
|
retval = CONTROL_LEFT;
|
||||||
|
break;
|
||||||
case 'j': /* Esc O j == '*' on numeric keypad with
|
case 'j': /* Esc O j == '*' on numeric keypad with
|
||||||
* NumLock off on VT100/VT220/VT320/xterm/
|
* NumLock off on VT100/VT220/VT320/xterm/
|
||||||
* rxvt/Eterm/Terminal. */
|
* rxvt/Eterm/Terminal. */
|
||||||
|
@ -896,10 +914,14 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
switch (seq[1]) {
|
switch (seq[1]) {
|
||||||
case 'a': /* Esc o a == Ctrl-Up on Eterm. */
|
case 'a': /* Esc o a == Ctrl-Up on Eterm. */
|
||||||
case 'b': /* Esc o b == Ctrl-Down on Eterm. */
|
case 'b': /* Esc o b == Ctrl-Down on Eterm. */
|
||||||
case 'c': /* Esc o c == Ctrl-Right on Eterm. */
|
|
||||||
case 'd': /* Esc o d == Ctrl-Left on Eterm. */
|
|
||||||
retval = get_escape_seq_abcd(seq[1]);
|
retval = get_escape_seq_abcd(seq[1]);
|
||||||
break;
|
break;
|
||||||
|
case 'c': /* Esc o c == Ctrl-Right on Eterm. */
|
||||||
|
retval = CONTROL_RIGHT;
|
||||||
|
break;
|
||||||
|
case 'd': /* Esc o d == Ctrl-Left on Eterm. */
|
||||||
|
retval = CONTROL_LEFT;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '[':
|
case '[':
|
||||||
|
@ -968,11 +990,15 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
* xterm. */
|
* xterm. */
|
||||||
case 'B': /* Esc [ 1 ; 5 B == Ctrl-Down on
|
case 'B': /* Esc [ 1 ; 5 B == Ctrl-Down on
|
||||||
* xterm. */
|
* xterm. */
|
||||||
|
retval = get_escape_seq_abcd(seq[4]);
|
||||||
|
break;
|
||||||
case 'C': /* Esc [ 1 ; 5 C == Ctrl-Right on
|
case 'C': /* Esc [ 1 ; 5 C == Ctrl-Right on
|
||||||
* xterm. */
|
* xterm. */
|
||||||
|
retval = CONTROL_RIGHT;
|
||||||
|
break;
|
||||||
case 'D': /* Esc [ 1 ; 5 D == Ctrl-Left on
|
case 'D': /* Esc [ 1 ; 5 D == Ctrl-Left on
|
||||||
* xterm. */
|
* xterm. */
|
||||||
retval = get_escape_seq_abcd(seq[4]);
|
retval = CONTROL_LEFT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue