]> Sergey Matveev's repositories - nnn.git/commitdiff
Fix #998: remove ^Space keybind
authorArun Prakash Jana <engineerarun@gmail.com>
Wed, 12 May 2021 04:37:29 +0000 (10:07 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Wed, 12 May 2021 04:37:29 +0000 (10:07 +0530)
netbsd-curses sends a NULL (key value 0) following the KEY_RESIZE.
The keybind ^Space also issues a 0. It seems even the key ^@ sends
the same. Dropping this ambiguous keybind in favour of alternative
key m (more appropriate for 'm'ark anyway). Keys with value 0 will
now be ignored in the filter function.

src/nnn.c
src/nnn.h

index 1cdc20d800ce33da654f27f2c1e64303234d19db..a8c8a6ca6bd833c4f36362582790af03a282e268 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2935,6 +2935,7 @@ static int filterentries(char *path, char *lastname)
 
                switch (*ch) {
 #ifdef KEY_RESIZE
+               case 0: // fallthrough
                case KEY_RESIZE:
                        clearoldprompt();
                        redraw(path);
@@ -3002,11 +3003,8 @@ static int filterentries(char *path, char *lastname)
                        break;
 
                /* Handle all control chars in main loop */
-               if (*ch < ASCII_MAX && keyname(*ch)[0] == '^' && *ch != '^') {
-                       if (keyname(*ch)[1] == '@')
-                               *ch = 'm';
+               if (*ch < ASCII_MAX && keyname(*ch)[0] == '^' && *ch != '^')
                        goto end;
-               }
 
                if (len == 1) {
                        if (*ch == '?') /* Help and config key, '?' is an invalid regex */
@@ -4590,7 +4588,7 @@ static void show_help(const char *path)
                 "b^R  Rename/dup%-14cr  Batch rename\n"
                  "cz  Archive%-17ce  Edit file\n"
                  "c*  Toggle exe%-14c>  Export list\n"
-          "5Space ^J  (Un)select%-7cm ^Space  Mark range/clear sel\n"
+          "5Space ^J  (Un)select%-12cm-m  Mark range/clear sel\n"
                  "ca  Select all%-14cA  Invert sel\n"
               "9p ^P  Copy sel here%-8cw ^W  Cp/mv sel as\n"
               "9v ^V  Move sel here%-11cE  Edit sel\n"
index 1e1e3dd9cf96fcf5aeff854bd8a80bfedcb590dc..95d4fc349d0e6eb57151a4dfb68ae4ee924c624c 100644 (file)
--- a/src/nnn.h
+++ b/src/nnn.h
@@ -213,7 +213,6 @@ static struct key bindings[] = {
        { ' ',            SEL_SEL },
        /* Toggle select multiple files */
        { 'm',            SEL_SELMUL },
-       { CONTROL(' '),   SEL_SELMUL },
        /* Select all files in current dir */
        { 'a',            SEL_SELALL },
        /* Invert selection in current dir */