After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 605299 - Please support xterm bracketed paste mode
Please support xterm bracketed paste mode
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
0.22.x
Other All
: Normal enhancement
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-12-23 10:36 UTC by Josh Triplett
Modified: 2009-12-28 02:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch implementing XTerm's bracketed paste mode in vte. (2.50 KB, patch)
2009-12-27 03:35 UTC, Josh Triplett
none Details | Review

Description Josh Triplett 2009-12-23 10:36:21 UTC
Xterm has a bracketed paste mode, in which it will send \e[200~ before pasted text and \e[201~ after pasted text.  This allows programs to distinguish pasted text from typed text.  For example, the following vim script will make vim automatically use paste mode for pastes, avoiding unwanted duplicate indentation or formatting:

if &term == "xterm"
    let &t_ti = &t_ti . "\e[?2004h"
    let &t_te = "\e[?2004l" . &t_te
    function XTermPasteBegin(ret)
        set pastetoggle=<Esc>[201~
        set paste
        return a:ret
    endfunction
    map <expr> <Esc>[200~ XTermPasteBegin("i")
    imap <expr> <Esc>[200~ XTermPasteBegin("")
endif

xterm itself supports bracketed paste mode, but vte does not, and thus neither do gnome-terminal and other terminals built on vte.

http://invisible-island.net/xterm/ctlseqs/ctlseqs.html documents the details of bracketed paste mode.  \e[?2004h turns on bracketed paste mode, and \e[?2004l turns it off.
Comment 1 Josh Triplett 2009-12-27 03:35:23 UTC
Created attachment 150437 [details] [review]
Patch implementing XTerm's bracketed paste mode in vte.

I've attached a git patch against current vte HEAD (7f017f27ff254995c1ad4fbe4947b929c4c6046f) that implements XTerm's bracketed paste mode.  (Please apply with "git am 0001-Bug-605299-Please-support-xterm-bracketed-paste-mode.patch".)

I tested this patch both with the "vte" test program and by running gnome-terminal with LD_LIBRARY_PATH pointing at new libvte (and --disable-factory so it would actually run a new instance with the new libvte).  In both cases, bracketed paste mode worked exactly as specified.
Comment 2 Behdad Esfahbod 2009-12-28 02:23:20 UTC
Committed.  Thanks!