Skip to content

Commit d44cc59

Browse files
committed
patch 8.2.2352: if focus lost/gained is received twice code is not ignored
Problem: If the focus lost/gained escape sequence is received twice it is not ignored. (Christ van Willigen) Solution: Adjust the logic to ignore the escape code.
1 parent 8f81b22 commit d44cc59

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/term.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5708,18 +5708,24 @@ check_termcode(
57085708
&& key_name[0] == KS_EXTRA
57095709
)
57105710
{
5711-
if (key_name[1] == KE_FOCUSGAINED && !focus_state)
5711+
if (key_name[1] == KE_FOCUSGAINED)
57125712
{
5713-
ui_focus_change(TRUE);
5714-
did_cursorhold = TRUE;
5715-
focus_state = TRUE;
5713+
if (!focus_state)
5714+
{
5715+
ui_focus_change(TRUE);
5716+
did_cursorhold = TRUE;
5717+
focus_state = TRUE;
5718+
}
57165719
key_name[1] = (int)KE_IGNORE;
57175720
}
5718-
else if (key_name[1] == KE_FOCUSLOST && focus_state)
5721+
else if (key_name[1] == KE_FOCUSLOST)
57195722
{
5720-
ui_focus_change(FALSE);
5721-
did_cursorhold = TRUE;
5722-
focus_state = FALSE;
5723+
if (focus_state)
5724+
{
5725+
ui_focus_change(FALSE);
5726+
did_cursorhold = TRUE;
5727+
focus_state = FALSE;
5728+
}
57235729
key_name[1] = (int)KE_IGNORE;
57245730
}
57255731
}

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2352,
753755
/**/
754756
2351,
755757
/**/

0 commit comments

Comments
 (0)