Bug since one of the later patches: :redraw during startup (e.g. from vimrc) causes gvim to redraw on the terminal

64 views
Skip to first unread message

lith

unread,
Dec 12, 2011, 2:02:01 AM12/12/11
to vim...@googlegroups.com
Hi,

After recompiling vim from the current sources, I noticed the following bug: A :redraw command that is called during startup, causes gvim to print its screen view on the terminal -- as if vim were called. This happens when I run gvim from gnome-terminal.

Unfortunately, I cannot tell which patch causes this but this bug must have been introduced after 340, I'd say.

Regards,
Tom

sc

unread,
Dec 12, 2011, 2:28:26 AM12/12/11
to vim...@googlegroups.com
On Sun, Dec 11, 2011 at 11:02:01PM -0800, lith wrote:
> Hi,

> After recompiling vim from the current sources, I noticed the following
> bug: A :redraw command that is called during startup, causes gvim to print
> its screen view on the terminal -- as if vim were called. This happens when
> I run gvim from gnome-terminal.

first verify you got a good compile: examine your

:ver

output, 3rd or 4th line, and see if it says something along the
lines of

Big version with GTK2 GUI.

no-one else on this list is having such a weird problem (or they
are being very secretive about it) so if your compile was good,
the next question might be answered by looking at the output
from

:scriptnames

> Unfortunately, I cannot tell which patch causes this but this bug must have
> been introduced after 340, I'd say.

which was about two months ago, and you're the first to report a
gui that doesn't come up

sc

Christian J. Robinson

unread,
Dec 12, 2011, 2:45:16 AM12/12/11
to vim...@googlegroups.com
On Mon, 12 Dec 2011, sc wrote:

> On Sun, Dec 11, 2011 at 11:02:01PM -0800, lith wrote:
>> After recompiling vim from the current sources, I noticed the
>> following bug: A :redraw command that is called during startup,
>> causes gvim to print its screen view on the terminal -- as if vim
>> were called. This happens when I run gvim from gnome-terminal.
>

> no-one else on this list is having such a weird problem (or they are
> being very secretive about it) so if your compile was good, the next
> question might be answered by looking at the output from

Or they haven't tested it for themselves yet...

>> Unfortunately, I cannot tell which patch causes this but this bug
>> must have been introduced after 340, I'd say.
>
> which was about two months ago, and you're the first to report a
> gui that doesn't come up

The bug report is not that the GUI does not come up, it's that the
terminal that gVim is invoked from gets drawn by gVim, then the GUI
does come up. The effect is somewhat like starting Vim in the
terminal, then immediately typing ":gui".

...Which is, incidentally, the behavior I can reproduce by putting
"redraw" in my .vimrc and then invoking gvim from a terminal.

While this is strange and definitely not correct behavior, the gVim
session does appear to work fine once it is fully initialized.

- Christian

--
Home, to a young boy, is merely a filling station.
Christian J. Robinson <hep...@gmail.com> http://christianrobinson.name/

lith

unread,
Dec 12, 2011, 10:44:16 AM12/12/11
to vim...@googlegroups.com

> The bug report is not that the GUI does not come up, it's that the terminal that gVim is invoked from gets drawn by gVim, then the GUI does come up.

Sorry for being imprecise. This is exactly what happens. The GUI comes up as always. It's just that a :redraw command in vimrc causes gvim to paint its view on the terminal first ... Then the gui is being displayed.

Regards,
Tom

Bram Moolenaar

unread,
Dec 12, 2011, 3:51:20 PM12/12/11
to lith, vim...@googlegroups.com

Tom Minilith wrote:

The startup sequence for the GUI was indeed changed. Calling :redraw in
the startup script is weird, you probably need to change that. If there
really are redrawing problems use a VimEnter or GUIEnter autocommand.

:autocmd VimEnter * redraw

--
In his lifetime van Gogh painted 486 oil paintings. Oddly enough, 8975
of them are to be found in the United States.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

James McCoy

unread,
Dec 12, 2011, 6:22:12 PM12/12/11
to vim...@googlegroups.com
On Sun, Dec 11, 2011 at 11:02:01PM -0800, lith wrote:
> After recompiling vim from the current sources, I noticed the following
> bug: A :redraw command that is called during startup, causes gvim to print
> its screen view on the terminal -- as if vim were called. This happens when
> I run gvim from gnome-terminal.

I was going to do a bisect to see when this got introduced, thinking it may
have been related to 7.3.315. However, in trying to find an old state where
that behavior didn't exist, I didn't have much luck. I went all the way back
to the v7-1-001 tag, saw that the behavior still existed there and gave up
searching.

> Unfortunately, I cannot tell which patch causes this but this bug must have
> been introduced after 340, I'd say.

Or it's existed for > 4.75 years and hadn't been noticed. I'd have to agree
with Bram that calling :redraw in ~/.vimrc is rather odd (there's no UI yet)
and that would be better served with VimEnter/GuiEnter depending on why you're
using it at all.

--
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jame...@jamessan.com>

signature.asc

lith

unread,
Dec 13, 2011, 12:38:26 PM12/13/11
to vim...@googlegroups.com, lith
Hi,


The startup sequence for the GUI was indeed changed.  Calling :redraw in
the startup script is weird, you probably need to change that.  If there
really are redrawing problems use a VimEnter or GUIEnter autocommand.

I now had time to investigate this a little bit further.

First, the problem was introduced during the latest patches. It's simply that I noticed the problem myself after recompiling vim.

Secondly, the original problem wasn't caused by a :redraw command but by setting a sign during startup. This seems to be a related bug report about a crash with MacVim: https://github.com/tomtom/quickfixsigns_vim/issues/13

I usually don't call :redraw during startup. This was meant as a minimal example to trigger the problem described.

Summary: The real culprit is :sign place that caused the original problem described above and seemingly causes macvim to crash. To add :redraw to vimrc is simply a way to trigger the same symptom. The problem probably has gone unnoticed for a longer time.

Regards,
Tom

lith

unread,
Dec 13, 2011, 12:40:24 PM12/13/11
to vim...@googlegroups.com, lith

First, the problem was introduced during the latest patches.

This should read: the problem was not ...

Regards,
Tom

Christian Brabandt

unread,
Dec 13, 2011, 2:24:01 PM12/13/11
to vim...@googlegroups.com
Hi lith!

On Di, 13 Dez 2011, lith wrote:

> > First, the problem was introduced during the latest patches.
>
>

> This should read: the problem was *not* ...

Can you provide a minimal example of the crash?

regards,
Christian
--
Patriotismus ist die Tugend der Bosheit.
-- Oscar Wilde

lith

unread,
Dec 14, 2011, 1:28:37 PM12/14/11
to vim...@googlegroups.com
Hi,


Am Dienstag, 13. Dezember 2011 20:24:01 UTC+1 schrieb Christian Brabandt:
Can you provide a minimal example of the crash?

Since I don't own a Mac, I cannot give an example for the crash, but the following example triggers the problem described above. I assume this was also what caused MacVim to crash since not placing a sign solved the problem.

gvim -u vimrc.test

where vimrc.test is

sign define Foo text=F
sign place 1 line=1 name=Foo buffer=1

Rehards,
Tom

Christian Brabandt

unread,
Jan 5, 2012, 7:53:44 AM1/5/12
to vim...@googlegroups.com
Hi lith!

Sorry, I forgot about this mail.

I see that this triggers redrawing the terminal, also the gui should be
used. I think, this patch fixes it:

0 2174 chrisbra@R500 ~/code/vim/src (hg)-[default]- % hg diff screen.c
diff --git a/src/screen.c b/src/screen.c
--- a/src/screen.c
+++ b/src/screen.c
@@ -766,7 +766,11 @@

/* Return when there is nothing to do or screen updating already
* happening. */
- if (!doit || updating_screen)
+ if (!doit || updating_screen
+#ifdef FEAT_GUI
+ || gui.in_use || gui.starting
+#endif
+ )
return;


regards,
Christian

Bram Moolenaar

unread,
Jan 5, 2012, 4:22:26 PM1/5/12
to Christian Brabandt, vim...@googlegroups.com

Christian Brabandt wrote:

> On Mi, 14 Dez 2011, lith wrote:
>
> > Hi,
> >
> > Am Dienstag, 13. Dezember 2011 20:24:01 UTC+1 schrieb Christian Brabandt:
> > >
> > > Can you provide a minimal example of the crash?
> >
> >
> > Since I don't own a Mac, I cannot give an example for the crash, but the
> > following example triggers the problem described above. I assume this was
> > also what caused MacVim to crash since not placing a sign solved the
> > problem.
> >
> > gvim -u vimrc.test
> >
> > where vimrc.test is
> >
> > sign define Foo text=F
> > sign place 1 line=1 name=Foo buffer=1
>
> Sorry, I forgot about this mail.
>
> I see that this triggers redrawing the terminal, also the gui should be
> used. I think, this patch fixes it:

What does this patch fix?

I can see some messing of the terminal when using "vim -u vimrc.test".
Your patch only changes something for the GUI, it appears. But the
problem also exists in the non-GUI version.

--
[Another hideous roar.]
BEDEVERE: That's it!
ARTHUR: What?
BEDEVERE: It's The Legendary Black Beast of Aaaaarrrrrrggghhh!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

Christian Brabandt

unread,
Jan 6, 2012, 2:21:06 AM1/6/12
to vim...@googlegroups.com
Hi Bram!

On Do, 05 Jan 2012, Bram Moolenaar wrote:

>
> Christian Brabandt wrote:
>
> > On Mi, 14 Dez 2011, lith wrote:
> >
> > > Hi,
> > >
> > > Am Dienstag, 13. Dezember 2011 20:24:01 UTC+1 schrieb Christian Brabandt:
> > > >
> > > > Can you provide a minimal example of the crash?
> > >
> > >
> > > Since I don't own a Mac, I cannot give an example for the crash, but the
> > > following example triggers the problem described above. I assume this was
> > > also what caused MacVim to crash since not placing a sign solved the
> > > problem.
> > >
> > > gvim -u vimrc.test
> > >
> > > where vimrc.test is
> > >
> > > sign define Foo text=F
> > > sign place 1 line=1 name=Foo buffer=1
> >
> > Sorry, I forgot about this mail.
> >
> > I see that this triggers redrawing the terminal, also the gui should be
> > used. I think, this patch fixes it:
>
> What does this patch fix?

I thought the problem was, that although the GUI will start, it still
draws the signs on the terminal.

> I can see some messing of the terminal when using "vim -u vimrc.test".
> Your patch only changes something for the GUI, it appears. But the
> problem also exists in the non-GUI version.

Yes, I was just looking at the GUI.

regards,
Christian

Bram Moolenaar

unread,
Jan 6, 2012, 3:19:12 PM1/6/12
to Christian Brabandt, vim...@googlegroups.com

Christian Brabandt wrote:

> > > On Mi, 14 Dez 2011, lith wrote:
> > >
> > > > Hi,
> > > >
> > > > Am Dienstag, 13. Dezember 2011 20:24:01 UTC+1 schrieb Christian Brabandt:
> > > > >
> > > > > Can you provide a minimal example of the crash?
> > > >
> > > >
> > > > Since I don't own a Mac, I cannot give an example for the crash, but the
> > > > following example triggers the problem described above. I assume this was
> > > > also what caused MacVim to crash since not placing a sign solved the
> > > > problem.
> > > >
> > > > gvim -u vimrc.test
> > > >
> > > > where vimrc.test is
> > > >
> > > > sign define Foo text=F
> > > > sign place 1 line=1 name=Foo buffer=1
> > >
> > > Sorry, I forgot about this mail.
> > >
> > > I see that this triggers redrawing the terminal, also the gui should be
> > > used. I think, this patch fixes it:
> >
> > What does this patch fix?
>
> I thought the problem was, that although the GUI will start, it still
> draws the signs on the terminal.

I also see it draw "~" lines.

> > I can see some messing of the terminal when using "vim -u vimrc.test".
> > Your patch only changes something for the GUI, it appears. But the
> > problem also exists in the non-GUI version.
>
> Yes, I was just looking at the GUI.

We should have a fix that also fixes it for the terminal. Can you
reproduce it with vim instead of gvim?

--
VOICE OVER: As the horrendous Black Beast lunged forward, escape for Arthur
and his knights seemed hopeless, when, suddenly ... the animator
suffered a fatal heart attack.
ANIMATOR: Aaaaagh!
VOICE OVER: The cartoon peril was no more ... The Quest for Holy Grail could
continue.

Christian Brabandt

unread,
Jan 9, 2012, 3:07:18 PM1/9/12
to vim...@googlegroups.com
Hi Bram!

On Fr, 06 Jan 2012, Bram Moolenaar wrote:

>
> Christian Brabandt wrote:
>
> > > > On Mi, 14 Dez 2011, lith wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > Am Dienstag, 13. Dezember 2011 20:24:01 UTC+1 schrieb Christian Brabandt:
> > > > > >
> > > > > > Can you provide a minimal example of the crash?
> > > > >
> > > > >
> > > > > Since I don't own a Mac, I cannot give an example for the crash, but the
> > > > > following example triggers the problem described above. I assume this was
> > > > > also what caused MacVim to crash since not placing a sign solved the
> > > > > problem.
> > > > >
> > > > > gvim -u vimrc.test
> > > > >
> > > > > where vimrc.test is
> > > > >
> > > > > sign define Foo text=F
> > > > > sign place 1 line=1 name=Foo buffer=1
> > > >
> > > > Sorry, I forgot about this mail.
> > > >
> > > > I see that this triggers redrawing the terminal, also the gui should be
> > > > used. I think, this patch fixes it:
> > >
> > > What does this patch fix?
> >
> > I thought the problem was, that although the GUI will start, it still
> > draws the signs on the terminal.
>
> I also see it draw "~" lines.

Yes.

> > > I can see some messing of the terminal when using "vim -u vimrc.test".
> > > Your patch only changes something for the GUI, it appears. But the
> > > problem also exists in the non-GUI version.
> >
> > Yes, I was just looking at the GUI.
>
> We should have a fix that also fixes it for the terminal. Can you
> reproduce it with vim instead of gvim?

This should fix it for gvim and vim

diff --git a/src/screen.c b/src/screen.c
--- a/src/screen.c
+++ b/src/screen.c

@@ -765,8 +765,13 @@


}

/* Return when there is nothing to do or screen updating already

- * happening. */
- if (!doit || updating_screen)
+ * happening or we are starting up. */


+ if (!doit || updating_screen
+#ifdef FEAT_GUI

+ || gui.starting
+#endif
+ || starting
+ )
return;

/* update all windows that need updating */


regards,
Christian

Bram Moolenaar

unread,
Jan 10, 2012, 6:42:27 AM1/10/12
to Christian Brabandt, vim...@googlegroups.com

Christian Brabandt wrote:

Thanks! I'll verify it works and include it.

--
It is illegal for a driver to be blindfolded while operating a vehicle.
[real standing law in Alabama, United States of America]

Reply all
Reply to author
Forward
0 new messages