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?
> 
> Try this: start gvim, add autocommands to FocusLost and FocusGained,
> then type ":!ls" which will bring up the "Press ENTER or type command
> to continue" prompt.  Now switch focus to another app and then back to
> gvim again and you'll notice that two more "Press ENTER ..." lines
> have appeared.  Each focus lost/gained event has called
> hit_return_msg().
> 
> >
> > 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'".
> 
> Ok, so is there nothing to do about this then?  How come then
> "--more--" prompt only appears once though?  (You can repeat the above
> procedure with ":digraphs" instead of ":!ls" to see this.)

Well, you can try this patch.  It's difficult to predict if this fails
in some situation.

*** ../vim-7.1.145/src/message.c        Thu Sep 13 22:04:30 2007
--- src/message.c       Sun Oct 28 20:42:40 2007
***************
*** 2850,2855 ****
--- 2850,2861 ----
      }
      else if (State == HITRETURN || State == SETWSIZE)
      {
+       if (msg_row == Rows - 1)
+       {
+           msg_didout = FALSE;
+           msg_col = 0;
+           msg_clr_eos();
+       }
        hit_return_msg();
        msg_row = Rows - 1;
      }


-- 
hundred-and-one symptoms of being an internet addict:
52. You ask a plumber how much it would cost to replace the chair in front of
    your computer with a toilet.

 /// 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