Describe the bug
In gVim, when a Netrw window is visible and the screen is refreshed, either
automatically or by doing CTRL-L
, gVim twitches and can even change size.
To Reproduce
gvim --clean
:source $VIMRUNTIME/plugin/netrwPlugin.vim
:Sexplore
CTRL-L
and note how gVim twitches. Elements of the GUI quickly:set guioptions=egL
CTRL-L
several times and note how the gVim window becomes narrower.Expected behavior
No twitching when the screen is refreshed. gVim window should not change size.
Screenshots
https://user-images.githubusercontent.com/57042631/131352404-440db7f7-4269-4a74-8637-7629371f0e47.mp4
Environment (please complete the following information):
Additional context
This bug does not affect Vim 8.2.3384. It also does not affect Vim run in a
terminal.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
This bug also affects gVim 8.2.3386 GTK3 on Kubuntu 21.04.
Just a guess, but does :set guioptions+=k
help?
It does not. With :set guioptions=egLk
, I still see the tool bar and the menu bar flicker. The gVim window still gets narrower when the screen is refreshed.
I ran in the same problem, did a git bisect to find the culprit
89a9c15 is the first bad commit.
The way I found out is described below, if this is not related, please let me know to open a new issue.
When I use :Ex
the gVim windows flashes the toolbar and gets narrower by one character.
I also use https://www.vim.org/scripts/script.php?script_id=2596 in order to have F11 mapped to full screen(remove the border&titlebar). When I use F11, columns and lines are set to a big value, using :Ex
in fullscreen will make gvim.exe run heavily for a minute (full CPU) before it displays the contents of directory.
I also use this script
function ToggleExplorer()
if &ft == "netrw"
if exists("w:netrw_rexfile")
if w:netrw_rexfile == "" || w:netrw_rexfile == "NetrwTreeListing"
exec 'q'
else
exec 'e ' . w:netrw_rexfile
endif
else
if exists("w:netrw_rexlocal")
Rexplore
else
exec 'q'
endif
endif
else
Explore
endif
endfun
I use this to open/close the Explorer, with the bug above the script won't work correctly.
The expected result is that calling this function will open explorer, calling it again inside an explorer will close it, or close vim is that is the only buffer.
With the bug, explorer opens, gets narrower, calling the function again will just make the editor narrower.
Also using gvim in Windows 10, compiled using MSVC.
Removing these two lines solved the problem for me:
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 5ea8319cf..252d664d6 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1680,7 +1680,6 @@ fun! s:NetrwOptionsSave(vt) endif let {a:vt}netrw_fokeep = &l:fo " formatoptions let {a:vt}netrw_gdkeep = &l:gd " gdefault - let {a:vt}netrw_gokeep = &l:go " guioptions let {a:vt}netrw_hidkeep = &l:hidden let {a:vt}netrw_imkeep = &l:im let {a:vt}netrw_iskkeep = &l:isk @@ -1832,7 +1831,6 @@ fun! s:NetrwOptionsRestore(vt) " call Decho("(s:NetrwOptionsRestore) #4 lines=".&lines) call s:NetrwRestoreSetting(a:vt."netrw_fokeep" ,"&l:fo") call s:NetrwRestoreSetting(a:vt."netrw_gdkeep" ,"&l:gd") - call s:NetrwRestoreSetting(a:vt."netrw_gokeep" ,"&l:go") call s:NetrwRestoreSetting(a:vt."netrw_hidkeep" ,"&l:hidden") " call Decho("(s:NetrwOptionsRestore) #5 lines=".&lines) call s:NetrwRestoreSetting(a:vt."netrw_imkeep" ,"&l:im")
These two lines were added recently, it 89a9c15. I don't know if this is the right solution though.
Cc @cecamp
Can you throw in a k
into the NetrwSetSafeSetting
call?
Removing the
https://github.com/vim/vim/blob/04626c243c47af91c2580eaf23e12286180e0e81/runtime/autoload/netrw.vim#L1754
Does solve the issue on my side.
I am using
guioptions=!c
I would guess it's the clipboard handling (e.g. the a
and A
flags).
Let me know if v172a helps.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
I've tried v172a but it does not fix this bug.
I've never installed a new version of Netrw before so I'm not entirely sure I did this correctly. I downloaded the netrw.vba.gz file, opened the file in Vim and did :so %
. This installed the files in my vimfiles
directory (I'm on Windows). I then opened a new instance of gVim, did :Se
and the banner displays v172a
. So I'm assuming I did install it correctly.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
How about this patch, on top of v172a?
diff --git a/autoload/netrw.vim b/autoload/netrw.vim index 81f89fc..7ce66d9 100644 --- a/autoload/netrw.vim +++ b/autoload/netrw.vim @@ -1751,7 +1751,7 @@ fun! s:NetrwOptionsSafe(islocal) if &cpo =~ 'a' | call s:NetrwSetSafeSetting("&cpo",substitute(&cpo,'a','','g')) | endif if &cpo =~ 'A' | call s:NetrwSetSafeSetting("&cpo",substitute(&cpo,'A','','g')) | endif setl fo=nroql2 - call s:NetrwSetSafeSetting("&go","egmr") + if &go =~ '\ca' | call s:NetrwSetSafeSetting("&go",substitute(&go,'\ca','','g')) | endif call s:NetrwSetSafeSetting("&l:hid",0) call s:NetrwSetSafeSetting("&l:im",0) setl isk+=@ isk+=* isk+=/
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
@gdupras Hello, thank you so much for your reply, the change above does solve my issue on my side.
Adding the other line of code
if &go =~ '\ca' | call s:NetrwSetSafeSetting("&go",substitute(&go,'\ca','','g')) | endif
won't add unexpected behavior in my GUI
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
The fix above also removes flashing of the menu bar in gVim on GNOME too.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
Closed #8820.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
I'll tentatively include this, I don't know when @cecamp will send a new version.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
I believe that netrw v172c already has this issue fixed. You may get it from my website: http://www.drchip.org/astronaut/vim/index.html
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
I tried v172c in the latest vim 8.2 on Windows 10 - it has other bugs - :E
in one window affects all windows across all tabs of the same file - say I have file1.c
open in 3 windows in one tab and 2 windows in another tab - :E
in any of these 5 windows opens the file explorer in all 5 windows and selecting file2.c
replaces file1.c
in all 5 windows with file2.c
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
Yes, I also had this issue with v172c. The current version of Vim (8.2.3565) has netrw v171 with the patch I suggested above. It has none of these issues (no flickering, no narrowing, no duplicated explorer window).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
Thanks for listing the vim version with your patch - I had looked at https://github.com/vim/vim-win32-installer/releases and did not see netrw mentioned in any recent build - then found eignn's repo
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.