summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgmont Koblinger <egmont@gmail.com>2013-09-23 09:22:47 +0200
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2013-09-23 09:27:55 +0200
commit8ac0a5f872b0024bab161fa020126013724758ba (patch)
treeae37613c8b5c978a6f2e6addb67ae860271ec341
parentFix some bugs in mouse tracking logic (diff)
downloadst-8ac0a5f872b0024bab161fa020126013724758ba.tar.gz
st-8ac0a5f872b0024bab161fa020126013724758ba.zip
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.
Diffstat (limited to '')
-rw-r--r--st.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/st.c b/st.c
index 3321c31..df58e9e 100644
--- a/st.c
+++ b/st.c
@@ -132,6 +132,7 @@ enum term_mode {
132 MODE_FOCUS = 65536, 132 MODE_FOCUS = 65536,
133 MODE_MOUSEX10 = 131072, 133 MODE_MOUSEX10 = 131072,
134 MODE_MOUSEMANY = 262144, 134 MODE_MOUSEMANY = 262144,
135 MODE_BRCKTPASTE = 524288,
135 MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\ 136 MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\
136 |MODE_MOUSEMANY, 137 |MODE_MOUSEMANY,
137}; 138};
@@ -1013,7 +1014,11 @@ selnotify(XEvent *e) {
1013 *repl++ = '\r'; 1014 *repl++ = '\r';
1014 } 1015 }
1015 1016
1017 if(IS_SET(MODE_BRCKTPASTE))
1018 ttywrite("\033[200~", 6);
1016 ttywrite((const char *)data, nitems * format / 8); 1019 ttywrite((const char *)data, nitems * format / 8);
1020 if(IS_SET(MODE_BRCKTPASTE))
1021 ttywrite("\033[201~", 6);
1017 XFree(data); 1022 XFree(data);
1018 /* number of 32-bit chunks returned */ 1023 /* number of 32-bit chunks returned */
1019 ofs += nitems * format / 32; 1024 ofs += nitems * format / 32;
@@ -1868,6 +1873,9 @@ tsetmode(bool priv, bool set, int *args, int narg) {
1868 case 1048: 1873 case 1048:
1869 tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); 1874 tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
1870 break; 1875 break;
1876 case 2004: /* 2004: bracketed paste mode */
1877 MODBIT(term.mode, set, MODE_BRCKTPASTE);
1878 break;
1871 /* Not implemented mouse modes. See comments there. */ 1879 /* Not implemented mouse modes. See comments there. */
1872 case 1001: /* mouse highlight mode; can hang the 1880 case 1001: /* mouse highlight mode; can hang the
1873 terminal by design when implemented. */ 1881 terminal by design when implemented. */