Added function ABCD(), better support for default settings
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@474 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
d9742c69c0
commit
1748cd1d0f
|
@ -21,6 +21,10 @@ General
|
||||||
do_browser()
|
do_browser()
|
||||||
- Added space and - keys to do page up and down.
|
- Added space and - keys to do page up and down.
|
||||||
- nano.c:
|
- nano.c:
|
||||||
|
ABCD()
|
||||||
|
- New function, figures out what kbinput to return given
|
||||||
|
input common to several switch statements, allows us to
|
||||||
|
support the default Konsole key settings.
|
||||||
main()
|
main()
|
||||||
- Alternate speller option no longer valid if DISABLE_SPELLER is
|
- Alternate speller option no longer valid if DISABLE_SPELLER is
|
||||||
active. (Rocco)
|
active. (Rocco)
|
||||||
|
|
31
nano.c
31
nano.c
|
@ -2028,6 +2028,26 @@ void do_toggle(int which)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function returns the correct keystroke, given the A,B,C or D
|
||||||
|
input key. This is a common sequence of many terms which send
|
||||||
|
Esc-O-[A-D] or Esc-[-[A-D]. */
|
||||||
|
int ABCD(int input)
|
||||||
|
{
|
||||||
|
switch(input)
|
||||||
|
{
|
||||||
|
case 'A':
|
||||||
|
return(KEY_UP);
|
||||||
|
case 'B':
|
||||||
|
return(KEY_DOWN);
|
||||||
|
case 'C':
|
||||||
|
return(KEY_RIGHT);
|
||||||
|
case 'D':
|
||||||
|
return(KEY_LEFT);
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int optchr;
|
int optchr;
|
||||||
|
@ -2275,6 +2295,8 @@ int main(int argc, char *argv[])
|
||||||
/* Alt-O, suddenly very important ;) */
|
/* Alt-O, suddenly very important ;) */
|
||||||
case 79:
|
case 79:
|
||||||
kbinput = wgetch(edit);
|
kbinput = wgetch(edit);
|
||||||
|
if (kbinput <= 'D' && kbinput >= 'A')
|
||||||
|
kbinput = ABCD(kbinput);
|
||||||
if (kbinput <= 'S' && kbinput >= 'P')
|
if (kbinput <= 'S' && kbinput >= 'P')
|
||||||
kbinput = KEY_F(kbinput - 79);
|
kbinput = KEY_F(kbinput - 79);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -2292,7 +2314,6 @@ int main(int argc, char *argv[])
|
||||||
keyhandled = 1;
|
keyhandled = 1;
|
||||||
break;
|
break;
|
||||||
case 91:
|
case 91:
|
||||||
|
|
||||||
switch (kbinput = wgetch(edit)) {
|
switch (kbinput = wgetch(edit)) {
|
||||||
case '1': /* Alt-[-1-[0-5,7-9] = F1-F8 in X at least */
|
case '1': /* Alt-[-1-[0-5,7-9] = F1-F8 in X at least */
|
||||||
kbinput = wgetch(edit);
|
kbinput = wgetch(edit);
|
||||||
|
@ -2369,16 +2390,10 @@ int main(int argc, char *argv[])
|
||||||
kbinput = KEY_F(kbinput - 64);
|
kbinput = KEY_F(kbinput - 64);
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
kbinput = KEY_UP;
|
|
||||||
break;
|
|
||||||
case 'B':
|
case 'B':
|
||||||
kbinput = KEY_DOWN;
|
|
||||||
break;
|
|
||||||
case 'C':
|
case 'C':
|
||||||
kbinput = KEY_RIGHT;
|
|
||||||
break;
|
|
||||||
case 'D':
|
case 'D':
|
||||||
kbinput = KEY_LEFT;
|
kbinput = ABCD(kbinput);
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
kbinput = KEY_HOME;
|
kbinput = KEY_HOME;
|
||||||
|
|
Loading…
Reference in New Issue