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)
diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt
index 5b7850f..0456a8b 100644
--- a/runtime/doc/term.txt
+++ b/runtime/doc/term.txt
@@ -373,6 +373,10 @@
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 @@
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.