mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 8.2.4490: terminal focus reporting only works for xterm-like terminals
Problem: Terminal focus reporting only works for xterm-like terminals. (Jonathan Rascher) Solution: Remove the "focus_mode" flag. (closes #9859)
This commit is contained in:
18
src/term.c
18
src/term.c
@@ -197,8 +197,7 @@ static char_u *vim_tgetstr(char *s, char_u **pp);
|
|||||||
static int detected_8bit = FALSE; // detected 8-bit terminal
|
static int detected_8bit = FALSE; // detected 8-bit terminal
|
||||||
|
|
||||||
#if (defined(UNIX) || defined(VMS))
|
#if (defined(UNIX) || defined(VMS))
|
||||||
static int focus_mode = FALSE; // xterm's "focus reporting" availability
|
static int focus_state = MAYBE; // TRUE if the Vim window has focus
|
||||||
static int focus_state = FALSE; // TRUE if the terminal window gains focus
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_TERMRESPONSE
|
#ifdef FEAT_TERMRESPONSE
|
||||||
@@ -2047,7 +2046,7 @@ set_termname(char_u *term)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_MOUSE_XTERM
|
#ifdef FEAT_MOUSE_XTERM
|
||||||
// focus reporting is supported by xterm compatible terminals and tmux.
|
// Focus reporting is supported by xterm compatible terminals and tmux.
|
||||||
if (use_xterm_like_mouse(term))
|
if (use_xterm_like_mouse(term))
|
||||||
{
|
{
|
||||||
char_u name[3];
|
char_u name[3];
|
||||||
@@ -2062,11 +2061,13 @@ set_termname(char_u *term)
|
|||||||
name[1] = KE_FOCUSLOST;
|
name[1] = KE_FOCUSLOST;
|
||||||
add_termcode(name, (char_u *)"\033[O", FALSE);
|
add_termcode(name, (char_u *)"\033[O", FALSE);
|
||||||
|
|
||||||
focus_mode = TRUE;
|
|
||||||
focus_state = TRUE;
|
|
||||||
need_gather = TRUE;
|
need_gather = TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if (defined(UNIX) || defined(VMS))
|
||||||
|
// First time after setting 'term' a focus event is always reported.
|
||||||
|
focus_state = MAYBE;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_TERM_CONSOLE
|
#ifdef USE_TERM_CONSOLE
|
||||||
// DEFAULT_TERM indicates that it is the machine console.
|
// DEFAULT_TERM indicates that it is the machine console.
|
||||||
@@ -3633,7 +3634,7 @@ starttermcap(void)
|
|||||||
|
|
||||||
#if defined(UNIX) || defined(VMS)
|
#if defined(UNIX) || defined(VMS)
|
||||||
// Enable xterm's focus reporting mode when 'esckeys' is set.
|
// Enable xterm's focus reporting mode when 'esckeys' is set.
|
||||||
if (focus_mode && p_ek && *T_FE != NUL)
|
if (p_ek && *T_FE != NUL)
|
||||||
out_str(T_FE);
|
out_str(T_FE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -3691,7 +3692,7 @@ stoptermcap(void)
|
|||||||
|
|
||||||
#if defined(UNIX) || defined(VMS)
|
#if defined(UNIX) || defined(VMS)
|
||||||
// Disable xterm's focus reporting mode if 'esckeys' is set.
|
// Disable xterm's focus reporting mode if 'esckeys' is set.
|
||||||
if (focus_mode && p_ek && *T_FD != NUL)
|
if (p_ek && *T_FD != NUL)
|
||||||
out_str(T_FD);
|
out_str(T_FD);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -5812,11 +5813,10 @@ check_termcode(
|
|||||||
* Handle FocusIn/FocusOut event sequences reported by XTerm.
|
* Handle FocusIn/FocusOut event sequences reported by XTerm.
|
||||||
* (CSI I/CSI O)
|
* (CSI I/CSI O)
|
||||||
*/
|
*/
|
||||||
if (focus_mode
|
if (key_name[0] == KS_EXTRA
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
&& !gui.in_use
|
&& !gui.in_use
|
||||||
# endif
|
# endif
|
||||||
&& key_name[0] == KS_EXTRA
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (key_name[1] == KE_FOCUSGAINED)
|
if (key_name[1] == KE_FOCUSGAINED)
|
||||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4490,
|
||||||
/**/
|
/**/
|
||||||
4489,
|
4489,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user