18

Gvim 7.4 on a Linux guest inside VirtualBox has serious redraw issues: often when I scroll up/down, the shown text gets corrupted (e.g., empty or with some "holes"). And I have to resize/rescroll to clean the screen. I've never experienced a similar problem either with Gvim or with Virtualbox, but it makes gvim almost unusable.

Some further information:

  • Virtualbox host distribution: Windows 7 64 bit
  • Virtualbox version: 4.3.12 with guest additions
  • Virtualbox guest distribution: Linux Mint 17 Qiana 64-bit Cinnamon
  • Gvim package: vim-gtk (but it happens using vim-gnome too)

Any idea how to solve this issue ?

Claudio
  • 10,614
  • 4
  • 31
  • 71
  • Perhaps the same problem as http://stackoverflow.com/q/20593268 – glts Jul 29 '14 at 17:29
  • Maybe. But no solution there either. – Claudio Jul 30 '14 at 08:24
  • Do Ctrl+L to force a redraw, instead of resize/scroll. Not a real solution, but... – rodrigo Jul 30 '14 at 08:29
  • Thanks! I'd like to have a real solution, though. I rely on gvim for almost all kind of editing (programming included). – Claudio Jul 30 '14 at 13:56
  • 1
    I know this question is a bit old, but I am facing the same problem. But I am using Gnome-Shell instead of Cinnamon. Right now I am using the workaround with MATE, but I would like to use Gnome-Shell again. Mac OSX 10.9.4 VirtualBox 4.3.14 VB guest additions 4.3.15 Debian Testing Gnome-Shell vim-gnome – evotion Aug 28 '14 at 08:00
  • I am facing the same problem on KDE5, the fix for me was to use OpenGL 3.1 instead of OpenGL 2.0 in the compositor configuration. – xis Jan 20 '16 at 19:50
  • FYI -- I've seen this error for years on VMWare + Ubuntu. I have yet to encounter a fix besides Ctrl-L. In fact, I just installed a fresh Ubuntu Server 16.10 on VMWare 8.1.1 on my Mac OSX 10.12.1, checked out VIM 8.0.55 from git, built it with Gtk2 and it STILL renders with gaps and holes. – PeterT Nov 02 '16 at 23:42
  • Similar issues on a FreeBSD (11.2-p5) host. Using the ccsm workaround improves the situation but there are still some glitches if you page up in a buffer (only does a partial redraw and needs a ctrl-l) for a full update. – Andrew Jun 04 '19 at 09:13

4 Answers4

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.

  • Awesome solution, thanks! Just curious, what led you to trying the compiz configs to fix this issue? I don't know how you ever discovered this solution. – Leng Sep 13 '15 at 01:26
  • 1
    Glat to hear it works! The pattern I see for this particular issue is Windows 7 host and VBox, thoughI have seen a vmware report too. Therefore I have a hunch it's not Guest Additions, but it is something to do with the "repaint" messages between GTK and OpenGL. I wanted to try yet more solutions such as installing an older build of Compiz, or replacing Compiz with another compositing. This led me to articles where people use this switch to fix tearing in videos, and other redraw issues. Doesn't address the bug, but seems to have no significant performance impact. –  Sep 13 '15 at 09:33
  • How to fix it on CentOS 7 ? I got the very same redraw issue using CentOS 7 on VirtualBox 5.0.8. However, option 1 cannot be used because compiz-manager is not available on CentOS 7. – Claudio Nov 11 '15 at 14:48
  • Just want to add, I had the same issue, fix is still working for ubuntu 15.10, however "workaround" has been renamed "solution" in ccsm. (which seems a bit sneaky imho) – Xavier T. Dec 19 '15 at 09:23
  • This problem has reappeared. I have a brand new machine with Windows 10, running VirtualBox 6.0.0 with Xubuntu 18.04.1 installed in it. Apt wants to install all of Compiz when installing the settings manager, so I don't think Compiz is installed as part of Xubuntu. So, that solution is out the window. – ikmac Jan 07 '19 at 01:22
3

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.

Claudio
  • 10,614
  • 4
  • 31
  • 71
  • Hi Claudio if you ever want to try Compiz / Ubuntu again on a Windows 7 host please try solution 1 below (Compiz Config Setting Manager workaround). I'd really like to know if this fixes the problem on other people's VM, and/or if it causes other noticable lags in the VM. –  Sep 12 '15 at 21:11
0

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.

malat
  • 12,152
  • 13
  • 89
  • 158
0

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.

mMontu
  • 8,983
  • 4
  • 38
  • 53