Christ van Willegen wrote:

> Op do 14 jan. 2021 17:36 schreef Bram Moolenaar <[email protected]>:
> 
> >
> > Patch 8.2.2345
> > Problem:    No focus events in a terminal.
> > Solution:   Add the t_fd and t_fe termcap entries and implement detecting
> >             focus events. (Hayaki Saito, Magnus Gro=C3=9F, closes #7673,
> >             closes #609, closes #5526)
> > Files:      runtime/doc/term.txt, src/optiondefs.h, src/term.c, src/term.=
> h
> >
> >
> >
> > +       {
> > +           int did_aucmd =3D FALSE;
> > +
> > +           if (key_name[1] =3D=3D KE_FOCUSGAINED && !focus_state)
> > +           {
> > +               did_aucmd =3D apply_autocmds(EVENT_FOCUSGAINED,
> > +                                                   NULL, NULL, FALSE,
> > curbuf);
> > +               did_cursorhold =3D TRUE;
> > +               focus_state =3D TRUE;
> > +               key_name[1] =3D (int)KE_IGNORE;
> > +           }
> > +           else if (key_name[1] =3D=3D KE_FOCUSLOST && focus_state)
> > +           {
> > +               did_aucmd =3D apply_autocmds(EVENT_FOCUSLOST,
> > +                                                   NULL, NULL, FALSE,
> > curbuf);
> > +               did_cursorhold =3D TRUE;
> > +               focus_state =3D FALSE;
> > +               key_name[1] =3D (int)KE_IGNORE;
> > +           }
> > +           if (did_aucmd && (State & (NORMAL | INSERT | TERMINAL)))
> > +           {
> > +               // in case a message was displayed: reposition the cursor
> > +               setcursor();
> > +               out_flush();
> > +           }
> > +       }
> > + #endif
> >
> 
> If the (Un)focus escape sequence happens to be sent twice, the key_name[1]
> will not be set to KE_IGNORE. Is that a problem?

It should not happen, but if it does happen it would be a problem.
It's easy enough to change.

-- 
hundred-and-one symptoms of being an internet addict:
149. You find your computer sexier than your girlfriend

 /// Bram Moolenaar -- [email protected] -- 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    ///

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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202101142058.10EKwNGr1690741%40masaka.moolenaar.net.

Raspunde prin e-mail lui