From 64fc494e0d6ad039b391ae135c7c800bc14a86cb Mon Sep 17 00:00:00 2001 From: ayin Date: Sun, 20 Jan 2008 14:12:38 +0000 Subject: [PATCH] implement bracketed paste mode (xterm private mode 2004). --- Changes | 1 + doc/rxvt.7.pod | 9 +++++++++ src/command.C | 1 + src/rxvt.h | 1 + src/screen.C | 6 ++++++ 5 files changed, 18 insertions(+) diff --git a/Changes b/Changes index f93ceb71..eb5889b2 100644 --- a/Changes +++ b/Changes @@ -18,6 +18,7 @@ WISH: look into XAddConnectionWatch, does anybody need that? DUMB: support tex fonts 9.0 + - implement bracketed paste mode (xterm private mode 2004). - fix a crash bug where urxvtd would crash when urxvtc was called with wrong arguments (I wish debian maintainers in general would report bugs and their proposed fixes to the original package maintaienrs diff --git a/doc/rxvt.7.pod b/doc/rxvt.7.pod index d6f9a012..0930bff3 100644 --- a/doc/rxvt.7.pod +++ b/doc/rxvt.7.pod @@ -1980,6 +1980,15 @@ X =end table +=item B<< C >> + +=begin table + + B<< C >> Enable bracketed paste mode - prepend / append to the pasted text the control sequences C / C + B<< C >> Disable bracketed paste mode + +=end table + =back =back diff --git a/src/command.C b/src/command.C index f1ec3ae4..205c5c6b 100644 --- a/src/command.C +++ b/src/command.C @@ -3632,6 +3632,7 @@ rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, // 1048 save and restore cursor { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */ // 1051, 1052, 1060, 1061 keyboard emulation NYI + { 2004, PrivMode_BracketPaste }, }; if (nargs == 0) diff --git a/src/rxvt.h b/src/rxvt.h index 6ed3551e..8b572dc7 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -556,6 +556,7 @@ enum { #define PrivMode_LFNL (1UL<<19) #define PrivMode_MouseBtnEvent (1UL<<20) #define PrivMode_MouseAnyEvent (1UL<<21) +#define PrivMode_BracketPaste (1UL<<22) #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent) diff --git a/src/screen.C b/src/screen.C index 7e1706fc..cb4ff517 100644 --- a/src/screen.C +++ b/src/screen.C @@ -2651,7 +2651,13 @@ rxvt_term::paste (char *data, unsigned int len) NOTHROW if (data[i] == C0_LF) data[i] = C0_CR; + if (priv_modes & PrivMode_BracketPaste) + tt_printf ("\e[200~"); + tt_write (data, len); + + if (priv_modes & PrivMode_BracketPaste) + tt_printf ("\e[201~"); } /* ------------------------------------------------------------------------- */ -- 2.34.1