On 2011-09-14, Christian Brabandt wrote:
> Hi Ben!
> 
> On Mi, 14 Sep 2011, Ben Fritz wrote:
> 
> > FocusLost and FocusGained seem to have some problems when dealing with
> > system() calls.
> > 
> > Starting with gvim -N -u NONE -i NONE, the first script (at the end of
> > this message) echos:
> > 
> > system command
> > focus gained
> > 
> > I would expect it to also echo "focus lost".
> > 
> > The second script echos:
> > 
> > system command
> > focus gained
> > 
> > I would expect it to only echo "system command".
> > 
> > More succinctly, FocusLost is never called with a system command even
> > though FocusGained is, and FocusGained is always called even if its
> > event is supposedly being ignored.
> > 
> > Since FocusLost/FocusGained often come in pairs which assume the
> > presence of the other, this can cause some weird problems.
> > 
> > First script:
> > 
> > autocmd FocusLost * echomsg "focus lost"
> > autocmd FocusGained * echomsg "focus gained"
> > 
> > echomsg system("echo system command")
> > 
> > Second script:
> > 
> > autocmd FocusLost * echomsg "focus lost"
> > autocmd FocusGained * echomsg "focus gained"
> > 
> > set ei=all
> > echomsg system("echo system command")
> > set ei&
> 
> I don't see that behaviour. For me, I don't get any FocusGained/Lost 
> Message in GTK-Gvim 7.3.315
> I don't even know, whether this is supposed to be triggered in the 
> terminal at least it doesn't trigger for me in an urxvt terminal. Ah, 
> the help says, it only triggers in certain terminals. May be xterm, no 
> doesn't work there either.

Using Vim 7.3.189, normal version with GTK2 GUI, on Fedora 11, both
as gvim and as vim in a GNOME Terminal, I see only the "system
command" message until I actually move the mouse in and out of the
window.  (I use focus follows mouse.)  Then gvim shows both "focus
gained" and "focus lost" messages as expected and vim shows nothing.

Using Vim 7.3.138 on Windows XP, sourcing the first script results
in

    system command
    focus gained

and sourcing the second script also results in

    system command
    focus gained

> Could that be Windows specific, may be?

Looks like it.

Regards,
Gary

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui