Bjorn Winckler wrote:

> This problem was brought up on the vim_mac list a while back but it
> turns out not to be mac specific so I am posting to the vim_dev list
> as well.
> 
> On 12/09/2007, Nico Weber <[EMAIL PROTECTED]> wrote:
> >
> > 1.) :!ls
> > 2.) hit space until the "Hit ENTER prompt" appears if necessary
> > 3.) Cmd-tab or cmd-` from and to the window where you did this
> >
> > Results: The prompt is drawn over and over (one additional line per
> > focus gained/lost).
> >
> > This also happens with Carbon Vim, but not with Ubuntu gvim (and of
> > course not with the terminal version), so I guess this is a mac
> > specific problem. Bjorn, if you fix this, let us know if your patch
> > can be adapted to carbon vim as well ;-)
> 
> I have finally looked into this problem and found out what causes it.
> In ui_focus_change() [ui.c] there is a line like this:
> 
>     need_redraw |= apply_autocmds(in_focus ? EVENT_FOCUSGAINED
>                               : EVENT_FOCUSLOST, NULL, NULL, FALSE, curbuf);
> 
> Now, apply_autocmds() returns 1 if an autocommand was applied which
> will set the need_redraw flag and eventually repeat_message() is
> called which in turn calls hit_return_msg() [both in message.c] and
> the "Press ENTER ..." message is displayed again.
> 
> If I run Vim without any autocommands on focus events, then the "Press
> ENTER ..." message is displayed only once...otherwise the message is
> repeated each time focus is lost or gained (and eventually fills the
> entire screen).
> 
> How should this be fixed?  There is some stuff going on in
> hit_return_msg() that I do not understand...the other messages called
> in repeat_message() seem to only rewrite the message on the same line
> whereas hit_return_msg() starts a new line.  I don't dare to just
> change hit_return_msg() so that it outputs the message on the same
> line every time, since this may break something else as far as I know.
>  Any ideas?

I don't see the sequence of events yet.  Why would Vim get more focus
change events?

When a focus autocommand is triggered, Vim may need to redraw, since
it's undefined what the autocommand has done.  Imagine the autocommand
does "echo 'focus gained'".

-- 
CVS sux, men don't like commitment

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui