patch 8.2.2345: no focus events in a terminal

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)
This commit is contained in:
Bram Moolenaar
2021-01-14 17:35:21 +01:00
parent 6601b62943
commit 681fc3fa78
5 changed files with 111 additions and 3 deletions

View File

@ -373,6 +373,10 @@ Added by Vim (there are no standard codes for these):
t_Ri restore icon text from stack *t_Ri* *'t_Ri'*
t_TE end of "raw" mode *t_TE* *'t_TE'*
t_TI put terminal into "raw" mode *t_TI* *'t_TI'*
t_fd disable focus-event tracking *t_TI* *'t_TI'*
|xterm-focus-event|
t_fe enable focus-event tracking *t_TI* *'t_TI'*
|xterm-focus-event|
Some codes have a start, middle and end part. The start and end are defined
by the termcap option, the middle part is text.
@ -546,6 +550,16 @@ And run "xrdb -merge .Xresources" to make it effective. You can check the
value with the context menu (right mouse button while CTRL key is pressed),
there should be a tick at allow-window-ops.
*xterm-focus-event*
Some terminals including xterm support the focus event tracking feature.
If this feature is enabled by the 't_fe' sequence, special key sequences are
sent from the terminal to Vim every time the terminal gains or loses focus.
Vim fires focus events (|FocusGained|/|FocusLost|) by handling them accordingly.
Focus event tracking is disabled by a 't_fd' sequence when exiting "raw" mode.
If you would like to disable this feature, add the following to your .vimrc:
`set t_fd=`
`set t_fe=`
*termcap-colors*
Note about colors: The 't_Co' option tells Vim the number of colors available.
When it is non-zero, the 't_AB' and 't_AF' options are used to set the color.