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.master
parent
0c5730708f
commit
7807848bda
|
@ -1,4 +1,4 @@
|
||||||
.Dd January 26, 2021
|
.Dd February 3, 2021
|
||||||
.Dt CATGIRL 1
|
.Dt CATGIRL 1
|
||||||
.Os
|
.Os
|
||||||
.
|
.
|
||||||
|
@ -658,7 +658,9 @@ Scroll up a page.
|
||||||
.El
|
.El
|
||||||
.
|
.
|
||||||
.Ss IRC Formatting
|
.Ss IRC Formatting
|
||||||
.Bl -tag -width Ds -compact
|
.Bl -tag -width "C-z C-v" -compact
|
||||||
|
.It Ic C-z C-v
|
||||||
|
Insert the next input character literally.
|
||||||
.It Ic C-z b
|
.It Ic C-z b
|
||||||
Toggle bold.
|
Toggle bold.
|
||||||
.It Ic C-z c
|
.It Ic C-z c
|
||||||
|
|
8
ui.c
8
ui.c
|
@ -1003,19 +1003,22 @@ void uiRead(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
wint_t ch;
|
wint_t ch;
|
||||||
static bool paste, style;
|
static bool paste, style, literal;
|
||||||
for (int ret; ERR != (ret = wget_wch(input, &ch));) {
|
for (int ret; ERR != (ret = wget_wch(input, &ch));) {
|
||||||
if (ret == KEY_CODE_YES && ch == KeyPasteOn) {
|
if (ret == KEY_CODE_YES && ch == KeyPasteOn) {
|
||||||
paste = true;
|
paste = true;
|
||||||
} else if (ret == KEY_CODE_YES && ch == KeyPasteOff) {
|
} else if (ret == KEY_CODE_YES && ch == KeyPasteOff) {
|
||||||
paste = false;
|
paste = false;
|
||||||
} else if (paste) {
|
} else if (paste || literal) {
|
||||||
edit(windows.ptrs[windows.show]->id, EditInsert, ch);
|
edit(windows.ptrs[windows.show]->id, EditInsert, ch);
|
||||||
} else if (ret == KEY_CODE_YES) {
|
} else if (ret == KEY_CODE_YES) {
|
||||||
keyCode(ch);
|
keyCode(ch);
|
||||||
} else if (ch == (L'Z' ^ L'@')) {
|
} else if (ch == (L'Z' ^ L'@')) {
|
||||||
style = true;
|
style = true;
|
||||||
continue;
|
continue;
|
||||||
|
} else if (style && ch == (L'V' ^ L'@')) {
|
||||||
|
literal = true;
|
||||||
|
continue;
|
||||||
} else if (style) {
|
} else if (style) {
|
||||||
keyStyle(ch);
|
keyStyle(ch);
|
||||||
} else if (iswcntrl(ch)) {
|
} else if (iswcntrl(ch)) {
|
||||||
|
@ -1024,6 +1027,7 @@ void uiRead(void) {
|
||||||
edit(windows.ptrs[windows.show]->id, EditInsert, ch);
|
edit(windows.ptrs[windows.show]->id, EditInsert, ch);
|
||||||
}
|
}
|
||||||
style = false;
|
style = false;
|
||||||
|
literal = false;
|
||||||
}
|
}
|
||||||
inputUpdate();
|
inputUpdate();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue