Hi,

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ß, closes #7673,
>             closes #609, closes #5526)
> Files:      runtime/doc/term.txt, src/optiondefs.h, src/term.c, src/term.h
>
>
>
> +       {
> +           int did_aucmd = FALSE;
> +
> +           if (key_name[1] == KE_FOCUSGAINED && !focus_state)
> +           {
> +               did_aucmd = apply_autocmds(EVENT_FOCUSGAINED,
> +                                                   NULL, NULL, FALSE,
> curbuf);
> +               did_cursorhold = TRUE;
> +               focus_state = TRUE;
> +               key_name[1] = (int)KE_IGNORE;
> +           }
> +           else if (key_name[1] == KE_FOCUSLOST && focus_state)
> +           {
> +               did_aucmd = apply_autocmds(EVENT_FOCUSLOST,
> +                                                   NULL, NULL, FALSE,
> curbuf);
> +               did_cursorhold = TRUE;
> +               focus_state = FALSE;
> +               key_name[1] = (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?

Christ van Willegen

>

-- 
-- 
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/CA%2BOt1Oy5HYPqu65-pJDBaE5R3hqWUhG0-MdV6pFtMVggRkX_mg%40mail.gmail.com.

Raspunde prin e-mail lui