Add C-z p to manually toggle paste mode

OpenBSD's xterm doesn't have bracketed paste mode, and it would be
nice to still be able to paste in several lines and collapse them
with M-q, provided one remembers to type C-z p first...
weechat-hashes
C. McEnroe 2021-02-15 19:07:56 -05:00
parent 66c67542ff
commit 4b26ae23cd
2 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
.Dd February 3, 2021 .Dd February 15, 2021
.Dt CATGIRL 1 .Dt CATGIRL 1
.Os .Os
. .
@ -669,6 +669,8 @@ Set or reset color.
Toggle italics. Toggle italics.
.It Ic C-z o .It Ic C-z o
Reset formatting. Reset formatting.
.It Ic C-z p
Manually toggle paste mode.
.It Ic C-z r .It Ic C-z r
Toggle reverse color. Toggle reverse color.
.It Ic C-z u .It Ic C-z u

5
ui.c
View File

@ -211,7 +211,8 @@ static short colorPair(short fg, short bg) {
X(KeyFocusIn, "\33[I", NULL) \ X(KeyFocusIn, "\33[I", NULL) \
X(KeyFocusOut, "\33[O", NULL) \ X(KeyFocusOut, "\33[O", NULL) \
X(KeyPasteOn, "\33[200~", NULL) \ X(KeyPasteOn, "\33[200~", NULL) \
X(KeyPasteOff, "\33[201~", NULL) X(KeyPasteOff, "\33[201~", NULL) \
X(KeyPasteManual, "\32p", "\32\20")
enum { enum {
KeyMax = KEY_MAX, KeyMax = KEY_MAX,
@ -1007,6 +1008,8 @@ void uiRead(void) {
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 (ret == KEY_CODE_YES && ch == KeyPasteManual) {
paste ^= true;
} else if (paste || literal) { } 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) {