björn wrote:
> On 28/10/2007, Bram Moolenaar <[EMAIL PROTECTED]> wrote:
>> 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.)
> 
> 
> /Björn

I have no FocusGained or FocusLost autocommands, yet if I leave gvim (with 
GTK2 GUI) at a Hit-Enter prompt, whenever it regains the focus (after having 
lost it to, say, Thunderbird) there is an additional Hit-Enter prompt.


Best regards,
Tony.
-- 
hundred-and-one symptoms of being an internet addict:
92. It takes you two hours to check all 14 of your mailboxes.


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

Raspunde prin e-mail lui