all repos — st @ 8ac0a5f872b0024bab161fa020126013724758ba

st (suckless terminal) config

Add bracketed paste mode

This patch enables bracketed paste mode (
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Bracketed%20Paste%20Mode
).

It's mainly useful for text editors to disable line wrapping and auto
indentation when text is being pasted, rather than typed from keyboard.

On the emulator side, it is supported by at least xterm, urxvt,
gnome-terminal, putty, iterm2; and I have a patch for konsole.

On the application side, vim can be configured easily to handle this, and
I have pending patches for mcedit and joe. Probably many others also
support it.
Egmont Koblinger egmont@gmail.com
commit

8ac0a5f872b0024bab161fa020126013724758ba

parent

eae31a532e1c3249abe3fe0dbce286cac263832f

1 files changed, 8 insertions(+), 0 deletions(-)

jump to
M st.cst.c

@@ -132,6 +132,7 @@ MODE_FBLINK = 32768,

MODE_FOCUS = 65536, MODE_MOUSEX10 = 131072, MODE_MOUSEMANY = 262144, + MODE_BRCKTPASTE = 524288, MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\ |MODE_MOUSEMANY, };

@@ -1013,7 +1014,11 @@ while((repl = memchr(repl, '\n', last - repl))) {

*repl++ = '\r'; } + if(IS_SET(MODE_BRCKTPASTE)) + ttywrite("\033[200~", 6); ttywrite((const char *)data, nitems * format / 8); + if(IS_SET(MODE_BRCKTPASTE)) + ttywrite("\033[201~", 6); XFree(data); /* number of 32-bit chunks returned */ ofs += nitems * format / 32;

@@ -1867,6 +1872,9 @@ break;

/* FALLTRU */ case 1048: tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); + break; + case 2004: /* 2004: bracketed paste mode */ + MODBIT(term.mode, set, MODE_BRCKTPASTE); break; /* Not implemented mouse modes. See comments there. */ case 1001: /* mouse highlight mode; can hang the