Actually running vim 8.0.586 (bug tested under Xubuntu16.04 and 16.10) I experienced
since more than a week that leaving vim makes the xterm set in bracketed paste mode.
As I am heavily relying on vim I wrote a wrapper script so I don't have to type:
printf "\e[?2004l"
each time I leave vim.
I found that bug "Disable bracketed paste mode for :r !cat?" was closed
10 days ago - maybe this regression may be related to the fix.
I hope my few information can help fixing the bug.
Many thanks for your help!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
Sorry, should have read the bug report 1st - cited bug 1638, as I understand it now,
was closed without doing a fix ... but my reported regression is new - it has to be
introduced less than 4 weeks ago (about two) and there was an update not changing
the situation.
Next time I am more focused to report the bug than finding a workaround ...
can you bisect the offending commit?
Hi,
is it related to my bug?
# clipboard content: /home/sylvain/local/share/applications
# pasting in xfce-terminal OK (shift-ctrl+v)
# /home/sylvain/local/share/applications
vim8 -u NONE
# just quit, now pasting produces:
#0~/home/sylvain/local/share/applications1~
now 0~ + 1~ surround the clipboard pasted content in the terminal.
Then clipboard content is not altered only the paste behavior in the terminal
vim8 --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May 2 2017 07:59:57)
Included patches: 1-596
Compiled by sylvain@sylvain-nuc
Huge version without GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_sgr +tag_old_static
+arabic +find_in_path -mouse_sysmouse -tag_any_white
+autocmd +float +mouse_urxvt -tcl
-balloon_eval +folding +mouse_xterm +termguicolors
-browse -footer +multi_byte +terminfo
++builtin_terms +fork() +multi_lang +termresponse
+byte_offset +gettext -mzscheme +textobjects
+channel -hangul_input +netbeans_intg +timers
+cindent +iconv +num64 +title
-clientserver +insert_expand +packages -toolbar
-clipboard +job +path_extra +user_commands
+cmdline_compl +jumplist -perl +vertsplit
+cmdline_hist +keymap +persistent_undo +virtualedit
+cmdline_info +lambda +postscript +visual
+comments +langmap +printer +visualextra
+conceal +libcall +profile +viminfo
+cryptv +linebreak +python +vreplace
+cscope +lispindent -python3 +wildignore
+cursorbind +listcmds +quickfix +wildmenu
+cursorshape +localmap +reltime +windows
+dialog_con -lua +rightleft +writebackup
+diff +menu -ruby -X11
+digraphs +mksession +scrollbind -xfontset
-dnd +modify_fname +signs -xim
-ebcdic +mouse +smartindent -xpm
+emacs_tags -mouseshape +startuptime -xsmp
+eval +mouse_dec +statusline -xterm_clipboard
+ex_extra -mouse_gpm -sun_workshop -xterm_save
+extra_search -mouse_jsbterm +syntax
+farsi +mouse_netterm +tag_binary
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/home/sylvain/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim8 -lm -ltinfo -lnsl -ldl -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
@Sylvain303: Yes, this is quite possible. Looks the same for me - did not spot it.
@chrisbra: Sorry, don't have the time - otherwise my bug report were opened more than one week earlier.
@brammool: AFAIK I did not change the configuration, thus Xubuntu seems to default to
TERM=xterm ... but yes, those are xfce4-terminal jobs.
This was never before a problem - so this should be a regression - or current distros may
not work properly if using latest vim (I am currently using a PPA to get vim 8 not part of
Xubuntu 16.10 and 16.04: https://launchpad.net/~jonathonf/+archive/ubuntu/vim).
Is vim more sensitive concerning terminals since the last few weeks?
So more info for the reader: http://cirw.in/blog/bracketed-paste
Also some XFCE term info: http://docs.xfce.org/apps/terminal/preferences
xfce-terminal man page says:
xfce4-terminal emulates the xterm application developed by the X
Consortium. In turn, the xterm application emulates the DEC VT102
terminal and also supports the DEC VT220 escape sequences. An escape
sequence is a series of characters that start with the Esc character.
xfce4-terminal accepts all of the escape sequences that the VT102 and
VT220 terminals use for functions such as to position the cursor and to
clear the screen.
indeed those command fixes the vim8 behavior:
printf "\e[?2004l"
or reset
#1638 :r !cat issue
I currently don't know with value should be OK for $TERM for xfce-terminal + vim8
I tested:
export TERM=xterm - default system no change
export TERM=xterm-256color
export TERM=xterm-color
export TERM=screen - restores paste mode OK
Some vim doc: https://vimhelp.appspot.com/term.txt.html#xterm-bracketed-paste
xubuntu (16.04) packaged vim (7.4) does support $TERM=xterm without letting bracketed-paste mode on when leaving.
to be continued...
http://vim.wikia.com/wiki/256_colors_in_vim
says:
XFCE's Terminal uses the same library as the Gnome Terminal to create the virtual terminal, so it actually makes sense to use the same TERM setting for the two terminal emulators. This logic applies in other cases, if an application uses Konsole's or rxvt's code to perform terminal emulation, you can accurately and properly use that application's TERM setting.
export TERM=gnome-256color works too, restoring bracketed-paste off when leaving
the offending commit seems to be 8.0.569, which is 62cf09b .
Environment: original GNOME terminal 2.32.1 on Ubuntu 11.04
vi -u NONE --noplugin -c :q
The copy/paste function will working abnormally after input above command on GNOME terminal ... (use mouse select any words then paste it.)
https://vimhelp.appspot.com/term.txt.html#xterm-bracketed-paste
Yes! It solved my problem. thanks! :)
Environment: original GNOME terminal 2.32.1 on Ubuntu 11.04
That is six years old and doesn't get security updates! Do consider upgrading.
FWIW gnome-terminal 3.20.2 (and, more importantly, libvte 2.91) from Ubuntu 17.04 do not suffer from this problem.
I'm not sure this is entirely vim's fault.
The issue is moreso that many terminals try to support bracketed paste, but don't actually do so properly.
See: https://bugs.launchpad.net/ubuntu/+source/vte/+bug/1350334/comments/6
Since there's no practical way to detect if the terminal emulator properly implements it, I don't see a way to fix that doesn't involve a regression of what 62cf09b was fixing in the first place.
I plopped this in my .vimrc on affected machines (my debian stable/jessie box running terminator). Just has vim issue a "turn off bracketed paste" on launch.
" workaround for https://github.com/vim/vim/issues/1start671 if has("unix") let s:uname = system("echo -n \"$(uname)\"") if !v:shell_error && s:uname == "Linux" set t_BE= endif endif
This works for me personally.
Any updates about this issue?
I'm using gnome terminal 2.31.3 (which comes with RHEL6) and must set t_BE= to avoid the corrupted pate issue in the terminal after exiting Vim.
I think that there is no reason to break old behavior, even if there is a workaround for that.
Thanks,
Ramel
It is not even clear, that this is a vim bug and not a terminal bug. Perhaps consider using a different terminal that supports bracketed-paste mode correctly.
—
You are receiving this because you commented.
Is it possible to save the bracket mode state when entering vim, and then restore it back when leaving?
—
You are receiving this because you commented.
OK, I understand. Thank you for this explanation.
—
You are receiving this because you commented.