summary refs log tree commit diff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rwxr-xr-xhome/.bin/hnel.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/home/.bin/hnel.c b/home/.bin/hnel.c
index bb087df1..981355a6 100755
--- a/home/.bin/hnel.c
+++ b/home/.bin/hnel.c
@@ -6,6 +6,7 @@ exec cc -Wall -Wextra -pedantic $@ -lutil -o $(dirname $0)/hnel $0
 
 #include <err.h>
 #include <poll.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <sys/ioctl.h>
 #include <sys/wait.h>
@@ -41,6 +42,7 @@ int main(int argc, char *argv[]) {
 
     if (argc < 2) return EX_USAGE;
 
+    bool enable = true;
     char table[256] = {0};
     table['n'] = 'j'; table['N'] = 'J'; table[CTRL('N')] = CTRL('J');
     table['e'] = 'k'; table['E'] = 'K'; table[CTRL('E')] = CTRL('K');
@@ -82,8 +84,13 @@ int main(int argc, char *argv[]) {
             if (len < 0) err(EX_IOERR, "read(%d)", STDIN_FILENO);
 
             if (len == 1) {
+                if (buf[0] == CTRL('S')) {
+                    enable = !enable;
+                    continue;
+                }
+
                 unsigned char c = buf[0];
-                if (table[c]) buf[0] = table[c];
+                if (enable && table[c]) buf[0] = table[c];
             }
 
             len = writeAll(master, buf, len);
8065fcabc35006c55b42a8771fa7cdedf4f31a8d&follow=1'>Make sure new cap is actually larger than new lengthJune McEnroe 2022-02-20Remove unused mbs.len field from struct EditJune McEnroe 2022-02-19Remove unneeded includes in ui.cJune McEnroe 2022-02-19Reimplement tab completeJune McEnroe 2022-02-19Handle errors from editFn, etc.June McEnroe 2022-02-19Reimplement text macrosJune McEnroe 2022-02-19Factor out input handling to input.cJune McEnroe 2022-02-19Factor out window management to window.cJune McEnroe 2022-02-19Enable -Wmissing-prototypesJune McEnroe 2022-02-19Fix edit.[ch] license notice additional permissionsJune McEnroe 2022-02-19Run line editing testsJune McEnroe 2022-02-18Implement new line editing "library"June McEnroe 2022-02-18Simplify cursor positioning in inputJune McEnroe 2022-02-18Fix M-f orderingJune McEnroe 2022-02-12Move sandman build to scripts/MakefileJune McEnroe 2022-02-12Use compat_readpassphrase.c on LinuxJune McEnroe 2022-02-12Copy RPP defines from oconfigureJune McEnroe