Gvim redraw issues with Virtual Box and Windows 7 host

拜拜、爱过 提交于 2019-12-03 01:50:12

There are lot of redraw issues. The solution(s) below address a very specific redraw issue with Windows 7 host, Linux guest, and Ubuntu (or Compiz).

Solution 1

Tested with the latest Virtual Box 5.0.4 & Guest Additions, Ubuntu 14.04.3, 3D Acceleration enabled, standard install with full updates.

a) sudo apt-get install compizconfig-settings-manager

b) Run it from the dash (type "ccsm"). Pick "Utility" on the left. Pick "Workarounds" (NOT the checkbox, click the button to enter sub category). "Force complete redraw on initial damage" should be on by default (not sure if relevant, just in case). Now ENABLE Force full screen redraws (buffer swap) on repaint, which is unchecked by default. The effect is immediate, if a gvim window is open just rapidly click between tabs, or jump top/bottom of files to see the difference.

Solution 2 (for 13.04, 13.10, or below)

If using 13.04 or below (perhaps 13.10 as well), first try to switch to Virtual Box 5.0.4+ (5.0.4 was tested) and its Guest Additions, install CCSM and test the workaround as described above (I can confirm this worked on my old 13.04 VM).

If that doesn't work or using the latest Virtual Box / Guest Additions is not an option then try to downgrade Guest Additions to version 4.2.12 (not just 4.2.x, trust me, I've tried many versions) NOTE that 4.2.12 won't work in Ubuntu 14.04.3+, due to the newer X Server version.

Older post below (some background)

Tests I went through:

  • Unity 2D: no bug, but ugly (no drop shadows, etc)
  • Mint 15 + CINNAMON : has bug
  • Mint 16 MATE : no bug, but some scroll bar issues
  • Mint 14.1 : no bug, because guest additions 4.1.18 pre-installed.. but SLOW!
  • ... upgrading guest additions to 4.3.6 : gvim bug reappears! <-- bingo

Finally, after hours and hours of rebooting VMs...

  • 4.2.12 : no gvim redraw bug, works perfectly for me (Ubuntu 13.04, Mint 15 Cinnamon), relatively smooth for a VM (with semi transparent Terminal, and all the 3D kinks)
  • 4.2.18 : no gvim redraw bug, but SLOW for some reason
  • 4.2.20 : BUG !
  • 4.3.6 : BUG !

Further

According to Bram Moolenaar "patch 7.3.638 merely removed an unnecessary redraw, which likely uncovered an existing problem" (with the GTK library).

However it's worth mentioning that I have been using an Ubuntu 13.04 VM for a year with Google Chrome, Firefox, Open Office, MySQL Workbench, etc. and have never had any other redraw issues. So even if it is a GTK bug it is a problem that appears to be closely tied to how VIM refreshes the window contents.

https://github.com/vim/vim/issues/91

Could be a GTK issue, but if it happens only with Windows 7 hosts... then it appears to be a "sync" problem between the GTK redraw / repaint events and the Open GL layer of Compiz (my guess).

How to reproduce / test bug

Open long text files in multiple tabs (saving/loading a session saves time).

Then quickly switch between tabs with Ctrl-PgUp / PgDn, or quickly move from top to bottom of a file with Ctrl-Home, Ctrl-End. Within seconds you will see only a part of the window refresh.

The problem is related to some bug of Cinnamon, maybe showing up only when run inside VirtualBox with 3D acceleration enabled. I discovered, in fact, that the display was corrupted also for other applications (e.g., media player).

I solved the problem by switching to the Mate window manager through the following steps:

  • Installed main mate packages
  • Installed also package mint-meta-mate
  • Logged out and selected Mate as window manager

Now gvim and all other apps work fine.

Could be out of scope here, since I am using Fedora 21 here; but since this is the #1 result for gvim refresh issue, I am adding this note for later reference.

Do not hesitate to allocate a lot of video memory. I had played with 2D accelation as well as 3D accelation option without any single change. The gulty party was that by default I only had 12Mo of video, I changed it to 128Mo and everythnig is working nicely now.

I faced the same problem under Salix OS. As changing the acceleration settings in VirtualBox didn't solve the issue, I find it easier to build gvim with GTK+ 3 (as the bug was triggered by GTK+ 2, as mentioned in @user4134275 answer) than messing with the Window Manager and Desktop Environment.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!