Tuesday, November 1, 2011

Vim splits resize switching between dual monitors

(By viewport I mean "window in the vim sense" as opposed to
the application window.)

Using Vim 7.3 patches 1 - 333 (the Vim without Cream
version) on XP SP3.

I have a dual-monitor system, both monitors are
the same size and resolution, the left-hand monitor is the
primary one so no negative desktop coordinates. I use the
http://dualmonitortool.sourceforge.net/swapscreen.html
utility, pressing Ctrl-F12 moves the selected window between
the two monitors. It seems to do this by making the window
redraw (visually it looks like it's redrawing all the
pieces). The problem is that sometimes, doing this
adjusts the position of horizontal splits on gvim.

I can reproduce the problem like this:

Invoke with gvim.exe -N -u NONE -U NONE -i NONE

Maximize the application

:split
The maximized vim now has two viewports
of equal height

Ctrl-F12
The application is now on the other monitor, the
split has moved so the lower viewport is five lines
taller than the upper.

I can't pin down exactly what triggers it, but it always
happens if you make the upper viewport much taller than
the lower. It happens with more than two viewports. Nothing
odd happens with just one viewport. It happens starting
from either monitor and switching to the other. It doesn't
happen if the application window isn't maximized, even if it
is stretched to the same size as it would be maximized. It
doesn't affect vertical splits.

My monitors are 1280x1024. If I adjust to e.g. 1024x768
the above sequence doesn't work, but it's still generally
reproducible by changing the viewport sizes and switching
between monitors.

So my questions are

Has anyone seen a similar problem before, if so how did you
address it?

Failing that ... any suggestions? Presumably the easiest
workaround is to reset the viewport sizes when this happens.
Can Vim tell when its window has moved? (FocusLost event
triggers but maybe there's a better way.)

Would restoring the viewport sessions be a simple task,
presumably they would have to be saved whenever they changed
(I can't see an event for this, maybe CursorHold would do)
then restored afterwards.

I could use winheight and resize to save and restore the
values.

Can anyone suggest a better approach, or comment on whether
this is likely to be extremely complicated? It's only
an incovenience so spending a lot of time fixing it wouldn't
be worth it.

regards,
Geoff

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: