Thanks for looking into this -- I have to take a look but I think your
fix may be the right one. Please send me a patch (git format-patch)
so that you appear as the patch author (if you wish).
I don't remember how to recreate the display bug that the commit above
fixed...I think you need to have both vertical and horizontal splits
(with text in each view) and then drag the dividers.
Björn
Thanks. I just tried reproducing with snapshot 52 (the version you
used when reporting this issue originally) and I can't repro either.
Weird.
I'm be happy to merge this, if there is a regression we'll just have
to find another fix, but...I notice several places in window.c where
the same line that you just patched appears. Should we perhaps change
all of them to NOT_VALID instead of CLEAR? I have to take a closer
look, but I'd value your input.
Björn
The problem as I can remember it (with the Core Text renderer) is that
splitting a window may cause a scrollbar to appear, thereby causing
the entire view to be shifted to the side. In this situation the
entire view really needs to be redrawn since Cocoa doesn't shift the
contents to make place for the scrollbar.
From what I can tell NOT_VALID should still be enough though so your
patch may still not cause any regressions.
Björn
I had another look and two of the CLEARs are definitely there because
of the scrollbar appearing. However, the CLEAR that your patch gets
rid of has nothing to do with this. Instead there seems to be some
problem with glyphs spilling over into the neighboring cell and under
certain circumstances these do not get cleared when dragging a
horizontal divider. This is how I can reproduce the problem:
1. go full screen (with Experimental Renderer!)
2. open a file, then :vsp
3. :sp some-other-file (this file should preferably have lots of text
with "w" in it)
4. drag the horizontal divider
Result: little blue dots litter the screen (left over by "w":s that
move as the result of dragging the divider). (I do this with a dark
color scheme and the default font.)
These artifacts disappear if the CLEAR flag is used instead of
NOT_VALID or SOME_VALID (in the spot your patch applies changes).
Mysteriously enough I cannot reproduce the same problems in windowed
mode (only full screen).
I must admit that the reason that I use "CLEAR" in the first place has
to do with how the experimental renderer tries to redraw as little of
the screen as possible and a more robust way of doing rendering would
get rid of all of these problems but it would also be slower.
I'm not sure what to do next. I could apply your patch (or revert the
one that introduced this problem) at the expense of introducing (tiny)
rendering artifacts that can be gotten rid of by pressing Ctrl-l. Or,
I could leave things as they are and try to come up with a better
rendering method (which I would not have time to do until the middle
of next year at the earliest). I'll have to think about it.
Björn
I had a look at this problem again last night and came up with a
solution [1] that seems to work fine but it may need some adjustment.
The CLEAR flag is no longer used so the Command-T plugin should work
fine now (please confirm).
To avoid the display corruption issue I had to be a bit creative, so
now whenever a cell is cleared the neighboring cells are cleared too
if they are blank. This takes care of the problem when a glyph spills
over into a neighboring (empty) display cell -- it used to be that
when such a glyph was erased it left a little trace behind in the
neighboring cell. The code path is pretty much the same as is used by
other GUIs when fake bold fonts are used (which often also spill over
into neighboring cells). I have not noticed slower rendering speeds
because of this change but in theory more clearing is done so keep an
eye out.
I'm guessing that there may still be a problem with glyphs which stick
out into display cells on top or below, but this will be font
dependent and I have not been able to reproduce with the default font.
Still, please report any reliable ways to reproduce display
corruptions and I will take a look (and probably not be able to fix
them easily, but I will still try).
For prosperity let me also mention that I experimented with clipping
each glyph to the size of one display cell to completely avoid the
"spilling" problem but this made the rendering unbearably slow.
Björn
[1] https://github.com/b4winckler/macvim/commit/caabb3f058870aec3baad9553d402d5d43a618e4
Thanks for the confirmation and for the very thorough initial report as well!
Björn