implement bracketed paste mode (xterm private mode 2004).
authorayin <ayin>
Sun, 20 Jan 2008 14:12:38 +0000 (14:12 +0000)
committerayin <ayin>
Sun, 20 Jan 2008 14:12:38 +0000 (14:12 +0000)
Changes
doc/rxvt.7.pod
src/command.C
src/rxvt.h
src/screen.C

diff --git a/Changes b/Changes
index f93ceb717142356fd31d4eec288b0b3158ed9249..eb5889b2f35dd145aeff9b2f5770d7400990dad2 100644 (file)
--- 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
index d6f9a012db8ee03039e5b540eec3161168b73c9e..0930bff3bfb1b480bfbe3736d587aae3eeb65f77 100644 (file)
@@ -1980,6 +1980,15 @@ X<Priv66>
 
 =end table
 
+=item B<< C<Pm = 2004> >>
+
+=begin table
+
+       B<< C<h> >>     Enable bracketed paste mode - prepend / append to the pasted text the control sequences C<ESC [ 200 ~> / C<ESC [ 201 ~>
+       B<< C<l> >>     Disable bracketed paste mode
+
+=end table
+
 =back
 
 =back
index f1ec3ae4a08f0c43f83321d36bb0750887f300ff..205c5c6b352662d22ed3eb8620cb5ac26405a3a2 100644 (file)
@@ -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)
index 6ed3551e5ade8935aa0280803f52cb44ff6188e9..8b572dc7d77155b9f0dda45af9e24416b30c92bd 100644 (file)
@@ -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)
 
index 7e1706fc534f70c5e20abd85519d8743ef13b8df..cb4ff5174ab1e8c5cff576f1d47ac3d29fb7c8b7 100644 (file)
@@ -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~");
 }
 
 /* ------------------------------------------------------------------------- */