diff options
author | June McEnroe <june@causal.agency> | 2021-02-03 14:52:16 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-02-03 14:52:16 -0500 |
commit | 7807848bda7a0522f20fa942b1c46fd55ad2beba (patch) | |
tree | d87688b44d989b447de5c8810e77dbc6cc3e4272 /ui.c | |
parent | chat.tmux.conf: Improve respawn, fix comment (diff) | |
download | catgirl-7807848bda7a0522f20fa942b1c46fd55ad2beba.tar.gz catgirl-7807848bda7a0522f20fa942b1c46fd55ad2beba.zip |
Add C-z C-v for literal next
A little annoying to make it a "chord" like this, but C-v is already used for scrolling, following Emacs-style key bindings (in order to have a way to scroll without using "special" keys like the arrows and page up/down), and C-z is at least already in the business of inserting control characters. This makes it possible to manually enter some things that are otherwise only possible with /exec printf.
Diffstat (limited to 'ui.c')
-rw-r--r-- | ui.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ui.c b/ui.c index e75e0eb..557d0dc 100644 --- a/ui.c +++ b/ui.c @@ -1003,19 +1003,22 @@ void uiRead(void) { } wint_t ch; - static bool paste, style; + static bool paste, style, literal; for (int ret; ERR != (ret = wget_wch(input, &ch));) { if (ret == KEY_CODE_YES && ch == KeyPasteOn) { paste = true; } else if (ret == KEY_CODE_YES && ch == KeyPasteOff) { paste = false; - } else if (paste) { + } else if (paste || literal) { edit(windows.ptrs[windows.show]->id, EditInsert, ch); } else if (ret == KEY_CODE_YES) { keyCode(ch); } else if (ch == (L'Z' ^ L'@')) { style = true; continue; + } else if (style && ch == (L'V' ^ L'@')) { + literal = true; + continue; } else if (style) { keyStyle(ch); } else if (iswcntrl(ch)) { @@ -1024,6 +1027,7 @@ void uiRead(void) { edit(windows.ptrs[windows.show]->id, EditInsert, ch); } style = false; + literal = false; } inputUpdate(); } |