]> git.wh0rd.org Git - nano.git/commitdiff
main() - Added Alt-[-[-7,8 support for home/end keys (Jeff Teunissen).
authorChris Allegretta <chrisa@asty.org>
Wed, 4 Jul 2001 16:06:21 +0000 (16:06 +0000)
committerChris Allegretta <chrisa@asty.org>
Wed, 4 Jul 2001 16:06:21 +0000 (16:06 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@718 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
nano.c

index d35246d5d74a0d1d38a6d4bd6f5b9f4d0aa1aa29..c11354868323d455109aa63123c5836a261e1866 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -115,6 +115,7 @@ Cvs code -
        - Add Alt-whatever-[a-d] support as well as Alt-whatever-[A-D].
   main()
        - Code to silently process "-g" and "-j" (Rocco)
+       - Added Alt-[-[-7,8 support for home/end keys (Jeff Teunissen).
   signal_init()
        - Reorder sigaction calls, use sigfillset() to stop SIGTSTP and
          SIGCONT from being interrupted, allows suspending nano
diff --git a/nano.c b/nano.c
index 2f945686f60e2987e36a6093ad41a0e27bdea55f..ab4578317850505f300d2429c5bcff4761990223 100644 (file)
--- a/nano.c
+++ b/nano.c
@@ -2613,8 +2613,27 @@ int main(int argc, char *argv[])
                    break;
                case '[':       /* Alt-[-[-[A-E], F1-F5 in linux console */
                    kbinput = wgetch(edit);
-                   if (kbinput >= 'A' && kbinput <= 'E')
+                   switch(kbinput) {
+                   case 'A':
+                   case 'B':
+                   case 'C':
+                   case 'D':
+                   case 'E':
                        kbinput = KEY_F(kbinput - 64);
+                       break;
+                   case 7:
+                       kbinput = KEY_HOME;
+                       break;
+                   case 8:
+                       kbinput = KEY_END;
+                       break;
+#ifdef DEBUG
+                   default:
+                       fprintf(stderr, _("I got Alt-[-[-%c! (%d)\n"),
+                               kbinput, kbinput);
+                       break;
+#endif
+                   }
                    break;
                case 'A':
                case 'B':