Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1401410
Summary: | f24->f25 vim: copy paste no longer works | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Ryan Rowe <ryanrowe> |
Component: | vim | Assignee: | Matthias Clasen <mclasen> |
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 25 | CC: | ahmadsamir3891, aoeuser, debarshir, dennis, djuran, d.lesca, egmont, gilboad, greta_watson, karsten, mclasen, moshima.web, pwouters, roger.bivand, work.eric, zdohnal |
Target Milestone: | --- | Keywords: | Reopened |
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | vim-8.0.133-2.fc25 vim-8.0.142-1.fc25 vim-8.0.142-1.fc24 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2017-01-05 20:22:12 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Ryan Rowe
2016-12-05 07:55:03 UTC
Possibly related to bug 1400088 and bug 1400477 Hi Ryan, it really seems it is not vim bug, because I have the same vim version on F24 and Copy/Paste works there. What I found out so far: 1) When you select some text with mouse, VIM goes into Visual mode automatically. 2) Copy/Paste works in certain way, when you select text and click on place, where you want to paste text, with mouse middle button. But it works only for same opened file, you cannot copy/paste out of vim. I will reassign it to gnome-terminal. When I completely upgrade OS to Fedora 25, behavior described in comment #2 mostly disappeared. I can select block of text without going into visual mode and I can use Edit->Copy from menu. Only thing, which appeared, is when I selected block of text and clicked on mouse middle button, it automatically goes into insert mode and pastes selected text after cursor. I do not know if this is correct behavior. Could you please clarify the description? In bullet point 4 you say "edit >copy" in gnome-terminal doesn't paste... not sure why "copy" would "paste". Three things to look at / be aware of: - The usual confusion between PRIMARY and CLIPBOARD in X11, or if Wayland is used then I have no clue how it goes there. - Whether VIM handles mouse events on its own rather than letting gnome-terminal select text. You could test it by a single right-click: Does it bring up gnome-terminal's context menu? Also what happens if you highlight the text with Shift+click instead of simple click? - VIM might enable "bracketed paste mode" in which case the characters that are pasted are enclosed between special marks. This makes it possible for VIM to handle them differently than if they were typed at the keyboard, e.g. automatically switch to insert mode rather than executing various (presumably unintended) commands. > Could you please clarify the description? In bullet point 4 you say "edit >copy" in gnome-terminal doesn't paste... not sure why "copy" would "paste". I never say that copy would paste, I describe two differences I encounter since upgrading from F24 to F25. Difference 1: (select some text then...) middle-click in gedit to paste -> nothing happens Difference 2: (select some text then...) go to edit> copy in gnome-terminal -> you can't. copy is grayed out. > The usual confusion between PRIMARY and CLIPBOARD in X11, or if Wayland is used then I have no clue how it goes there. This is covered by the two test cases shown above in this comment. > - Whether VIM handles mouse events on its own rather than letting gnome-terminal select text. You could test it by a single right-click: Does it bring up gnome-terminal's context menu? It does not bring up gnome-terminal's context menu. (In reply to Ryan Rowe from comment #5) > It does not bring up gnome-terminal's context menu. This means that VIM handles the mouse events (click, drag etc.). If the "selected" characters are visually highlighted (e.g. inverted), it's done by VIM manually. From gnome-terminal's point of view, there's no copy operation whatsoever going on. It only reports mouse events to VIM, just as e.g. it would report them to MC or any other mouse-aware app. Use Shift+Click to override and make a selection in gnome-terminal. Or disable mouse support in your VIM. This is the intended behavior. It is not intended behavior if it is an undocumented change, I will re-assign to vim. What's the output of :set mouse? Please have a look at :help mouse and try the different settings. Which one gives you the expected behaviour ? Wait a second... shift click brings up the gt-t menu, but I still can't choose Copy, it's grayed out. Same as Edit> Copy is grayed out. > What's the output of :set mouse? mouse = a > Please have a look at :help mouse and try the different settings. Which one gives you the expected behaviour ? set mouse=v seems good. (In reply to Ryan Rowe from comment #9) > Wait a second... shift click brings up the gt-t menu, but I still can't > choose Copy, it's grayed out. Same as Edit> Copy is grayed out. You need to make your selection with with Shift+click. Otherwise it's VIM that handles the click+drag events and not gnome-terminal itself creating a selection. I am running Fedora 24, kernel 4.8.12-200.fc24.x86_64, KDE spin. When vim-enhanced, vim-common, vim-filesystem, and vim-minimal were updated from 2:7.4.1718-1.fc24.x86_64 to 2:8.0.124-2.fc24.x86_64, the behavior of paste using the middle mouse button changed when vim was invoked from the command line. In the earlier version, clicking the middle button would copy the contents of the clipboard into the file that vim was dealing with, at the specified insert location. In the later version, the clipboard would not be copied. Instead, one blank character would be copied. However, by running the later version in the compatible mode (vim -C), the contents of the clipboard are copied. The behavior of /bin/vi did not change--it continues to copy the clipboard. Hi Greta, would you mind trying to set mouse=v, if it helps? Like Ryan said in comment #9? set mouse=v works. shift click (with or without set mouse=v) also works. vim-8.0.133-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-ac0548af76 vim-8.0.133-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-ed409d5de3 vim-8.0.133-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-ac0548af76 vim-8.0.133-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-ed409d5de3 vim-8.0.133-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report. In Fedora 24, I updated vim-common, vim-minimal, vim-enhanced, and vim-filesystem to 8.0.133-2.fc24.x86_64. /etc/vimrc has the line: set mouse=v. However, when I invoke vim, and set mouse, the value is "a" rather than "v". What else do I need to do? I can still get it to work by invoking "vim -C", using shift click, or manually setting mouse=v. This change effectively breaks gvim for the normal usage pattern. You can no longer use the mouse to move the cursor. It only selects text now. Reading the docs I guess that would make sense since mouse=v makes it behave like visual mode only which before only happened when you dragged. It doesn't work in insert mode like mouse=a did before which positions the cursor with a single click. In fact upon further testing console vim behaves almost the same as a GNOME vim does now when mouse=a. If you set mouse=a and then use "+y, followed by "+p then you can copy and paste to the system clipboard just like GNOME vim would. In fact if I unset mouse=a in /etc/vimrc it does exactly what the default behavior is as documented in vim and does the right thing in both console vim and gvim. 'mouse' string (default "", "a" for GUI, MS-DOS and Win32, set to "a" in defaults.vim) I'm actually wondering why others were having a problem with this before. As far as I can remember after doing a dnf system upgrade from F24 to F25 I wasn't having a problem until now. If someone here is having the problem still and hasn't upgraded the vim package yet can they try ":set mouse" in vim and see what it reports? any combination of vim -C or vim with /etc/vimrc containing no mouse line, set mouse=v or set mouse=a causes the same broken failure of copy&paste. This is on fedora 25 with 8.0.133-2 of all vim packages involved. Using :set mouse=v inside vim does seem to work around it note creating a ~/.vimrc just containing set mouse=v is a workaround that does work. So it seems perhaps the setting in /etc/vimrc is lost or not read properly (i did not have a .vimrc before creating it with this workaround) For people who are having issues with console vim you can create a ~/.vimrc with "set mouse=" which will make it behave like the expected vim default setting and copy/paste works. Although if you do this it will break cursor position in gvim unless you create ~/.gvimrc with "set mouse=a" as well. I have both a ~/.vimrc and ~/.gvimrc and neither has any mouse settings and I was getting the default vim behavior until this recent change in /etc/vimrc. If people don't have ~/.vimrc files and were before getting mouse=a in console vim that's quite strange. Although in /usr/share/vim/vim80/defaults.vim I see: if has('mouse') set mouse=a endif So this makes me think some terminal emulators are reporting a mouse is present while others are not maybe? Do you guys happen to be running wayland? I play games occasionally so I have the official nvidia driver installed and I'm still running Xorg using gnome-terminal. On my Fedora 25 I have update now to vim-*-8.0.133-2.fc25.x86_64 [lesca@dodo ~]$ LANG=C vim --version|head -2 VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Dec 15 2016 16:47:44) Included patches: 1-133 with this changelog: [lesca@dodo ~]$ rpm -q vim-minimal --changelog|head -3 * gio dic 15 2016 Zdenek Dohnal <zdohnal> - 2:8.0.133-2 - f24->f25 vim: copy paste no longer works (bug #1401410) - change mouse default setting to 'v' The mouse problem still exist and the mouse setting still to be =a [lesca@dodo ~]$ grep set\ mouse !$ grep set\ mouse /usr/share/vim/vim80/defaults.vim set mouse=a Without "echo 'set mouse=' >> ~/.vimrc", the copy/paste mouse action, when use vim into mate-terminal, not work property IMHO, modify the "set mouse=a" line into /usr/share/vim/vim80/defaults.vim, and set it to "set mouse=" or "set mouse=v" Create a .vimrc files for my and root users (sudo vim /etc/...) on all my Fedora Workstation and server is an annoying job This is a change in vim 8* (since patch 7.4.2111); now when no ~/.vimrc file is found the defaults.vim (/usr/share/vim/vim80/defaults.vim) script is used; which has 'mouse=a'. defaults.vim is loaded after /etc/vimrc from [1]: Patch 7.4.2319 Problem: No way for a system wide vimrc to stop loading defaults.vim. (Christian Hesse) Solution: Bail out of defaults.vim if skip_defaults_vim was set. so it overrides values set in /etc/vimrc. [1] https://github.com/vim/vim/blob/5162822914372fc916a93f85848c0c82209e7cec/runtime/doc/version8.txt#L14219 https://github.com/vim/vim/blob/5162822914372fc916a93f85848c0c82209e7cec/runtime/doc/starting.txt#L1038 Where I must set 'skip_defaults_vim'? Into /etc/vimrc ? ... or into my ~/.vimrc? .. or into some other place? The goal is restore the previous mouse behaviour. Without forcing all users to change all their systems, and this can be done only by releasing a specific patch to vim or its default configuration files... Why it's not possible release a defaults.vim with "set mouse=v" or "set mouse=" ? ... or did I miss something? Thanks. Dario Hi, I deeply apologize for problems, I am new co-maintainer of VIM and I thought putting set mouse=v into /etc/vimrc will solve issue. I will quickly create new build with Dario's suggestion (putting it into defaults.vim) and update it. I would suggest something like the following not to break gvim: if !has("gui_running") set mouse= endif Erik, are you suggesting that we should leave: if has('mouse') set mouse=a endif as it is now and only add after that your suggestion: if !has("gui_running") set mouse= endif OK... according to strace /etc/vimrc is always read and it's read first. If ~/.vimrc is present then defaults.vim is not read. Basically one or the other. I think I see the problem now and I can reproduce it. You just need to remove the following block from defaults and it should work like it's suppose to: " In many terminal emulators the mouse works just fine. By enabling it you " can position the cursor, Visually select and scroll with the mouse. if has('mouse') set mouse=a endif If you have a ~/.vimrc file it won't mess with the mouse and that's why it worked for me until /etc/vimrc was changed. GNOME terminal must support mouse reporting which is why this triggers without a ~/.vimrc. If you did not have ~/.vimrc and this mouse setting was removed it will be like default again, mouse=a for gui and mouse= for console. 1. Remove the mouse line added to /etc/vimrc 2. Remove the above block from defaults.vim Now the mouse is not messed with and the defaults makes everyone happy again. Normal select and middle click work in the terminal and gvim you can still click to move the cursor and drag to copy/paste. Ok, thank you very much, Eric. Builds will be in 15 minutes with your suggested changes and I will put here links to koji, where everybody can download it and install it now, without waiting for update. vim-8.0.134-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-0281ab71ff Builds are done: https://koji.fedoraproject.org/koji/taskinfo?taskID=16954386 for f24 https://koji.fedoraproject.org/koji/taskinfo?taskID=16954503 for f25 vim-8.0.134-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-be5fa630c5 I have download and install this new package on a f25 test system and the mouse into a gnome-terminal work like expected. [lesca@linux140 ~]$ vim --version |head -2 VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Dec 19 2016 08:17:13) Patch incluse: 1-134 [lesca@linux140 ~]$ grep mouse= /usr/share/vim/vim80/defaults.vim [lesca@linux140 ~]$ grep mouse= /etc/vimrc Thank to all. Dario *** Bug 1405934 has been marked as a duplicate of this bug. *** (In reply to Zdenek Dohnal from comment #27) > Hi, > > I deeply apologize for problems, I am new co-maintainer of VIM and I thought > putting set mouse=v into /etc/vimrc will solve issue. I will quickly create > new build with Dario's suggestion (putting it into defaults.vim) and update > it. That was a change that Zdenek discussed with me (the 'main' VIM maintainer) before doing the update and we agreed on this workaround. I didn't notice that defaults.vim would overwrite settings from the vimrc, what's the point of that upstream change anyway ? Thanks for all that valuable feedback and your suggestions for a better fix. Please test Zdenek's latest update and give feedback if mouse behaviour is still wrong in either gvim or vim. (In reply to Dario Lesca from comment #26) > Where I must set 'skip_defaults_vim'? > Into /etc/vimrc ? ... or into my ~/.vimrc? .. or into some other place? > In /etc/vimrc at the top: let skip_defaults_vim=1 (if you have a ~/.vimrc defaults.vim isn't loaded at all anyway). (In reply to Karsten Hopp from comment #37) > (In reply to Zdenek Dohnal from comment #27) > > Hi, > > > > I deeply apologize for problems, I am new co-maintainer of VIM and I thought > > putting set mouse=v into /etc/vimrc will solve issue. I will quickly create > > new build with Dario's suggestion (putting it into defaults.vim) and update > > it. > > That was a change that Zdenek discussed with me (the 'main' VIM maintainer) > before doing the update and we agreed on this workaround. I didn't notice > that defaults.vim would overwrite settings from the vimrc, what's the point > of that upstream change anyway ? > IMHO, I agree what's the point of having defaults that only affect users who don't have a ~/.vimrc? /etc/vimrc is loaded even with a ~/.vimrc, and one can override individual settings in ~/.vimrc. I suggest to discard all the settings from defaults.vim by adding: let skip_defaults_vim=1 at the top of /etc/vimrc (with a comment explaining the issue). Then you can look at the upstream default settings in defaults.vim, if there's something useful as a default that /etc/vimrc doesn't already have then add it to /etc/vimrc. vim-8.0.134-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-0281ab71ff vim-8.0.134-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-be5fa630c5 I can confirm 8.0.134.2 solves the problem on multiple machines. Thanks. vim-enhanced-2:8.0.134-2.fc24.x86_64 solved the problem for Fedora 24. Thank-you. vim-8.0.142-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-562277cfd8 vim-8.0.142-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-73038b8d65 vim-8.0.142-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-562277cfd8 vim-8.0.142-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report. vim-8.0.142-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report. *** Bug 1382426 has been marked as a duplicate of this bug. *** |