forked from aniani/vim
patch 9.0.1065: a shell command switching screens may still have a problem
Problem: A shell command switching screens may still have a problem with
the kitty keyboard protocol.
Solution: Disable the kitty keyboard protocol both in the current and the
alternate screen, if there are indications it might be needed.
(issue #11705) Also fix naming.
This commit is contained in:
@@ -1396,12 +1396,12 @@ typedef enum {
|
|||||||
MOKS_OFF,
|
MOKS_OFF,
|
||||||
// Used when receiving the state and the level is two.
|
// Used when receiving the state and the level is two.
|
||||||
MOKS_ENABLED,
|
MOKS_ENABLED,
|
||||||
// Used after outputting t_KE when the state was MOKS_ENABLED. We do not
|
// Used after outputting t_TE when the state was MOKS_ENABLED. We do not
|
||||||
// really know if t_KE actually disabled the protocol, the following t_KI
|
// really know if t_TE actually disabled the protocol, the following t_TI
|
||||||
// is expected to request the state, but the response may come only later.
|
// is expected to request the state, but the response may come only later.
|
||||||
MOKS_DISABLED,
|
MOKS_DISABLED,
|
||||||
// Used after outputting t_KE when the state was not MOKS_ENABLED.
|
// Used after outputting t_TE when the state was not MOKS_ENABLED.
|
||||||
MOKS_AFTER_T_KE,
|
MOKS_AFTER_T_TE,
|
||||||
} mokstate_T;
|
} mokstate_T;
|
||||||
|
|
||||||
// Set when a response to XTQMODKEYS was received. Only works for xterm
|
// Set when a response to XTQMODKEYS was received. Only works for xterm
|
||||||
@@ -1416,12 +1416,12 @@ typedef enum {
|
|||||||
KKPS_OFF,
|
KKPS_OFF,
|
||||||
// Used when receiving the state and the flags are non-zero.
|
// Used when receiving the state and the flags are non-zero.
|
||||||
KKPS_ENABLED,
|
KKPS_ENABLED,
|
||||||
// Used after outputting t_KE when the state was KKPS_ENABLED. We do not
|
// Used after outputting t_TE when the state was KKPS_ENABLED. We do not
|
||||||
// really know if t_KE actually disabled the protocol, the following t_KI
|
// really know if t_TE actually disabled the protocol, the following t_TI
|
||||||
// is expected to request the state, but the response may come only later.
|
// is expected to request the state, but the response may come only later.
|
||||||
KKPS_DISABLED,
|
KKPS_DISABLED,
|
||||||
// Used after outputting t_KE when the state was not KKPS_ENABLED.
|
// Used after outputting t_TE when the state was not KKPS_ENABLED.
|
||||||
KKPS_AFTER_T_KE,
|
KKPS_AFTER_T_TE,
|
||||||
} kkpstate_T;
|
} kkpstate_T;
|
||||||
|
|
||||||
EXTERN kkpstate_T kitty_protocol_state INIT(= KKPS_INITIAL);
|
EXTERN kkpstate_T kitty_protocol_state INIT(= KKPS_INITIAL);
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ list_mappings(
|
|||||||
case MOKS_OFF: name = _("Off"); break;
|
case MOKS_OFF: name = _("Off"); break;
|
||||||
case MOKS_ENABLED: name = _("On"); break;
|
case MOKS_ENABLED: name = _("On"); break;
|
||||||
case MOKS_DISABLED: name = _("Disabled"); break;
|
case MOKS_DISABLED: name = _("Disabled"); break;
|
||||||
case MOKS_AFTER_T_KE: name = _("Cleared"); break;
|
case MOKS_AFTER_T_TE: name = _("Cleared"); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[200];
|
char buf[200];
|
||||||
@@ -344,7 +344,7 @@ list_mappings(
|
|||||||
case KKPS_OFF: name = _("Off"); break;
|
case KKPS_OFF: name = _("Off"); break;
|
||||||
case KKPS_ENABLED: name = _("On"); break;
|
case KKPS_ENABLED: name = _("On"); break;
|
||||||
case KKPS_DISABLED: name = _("Disabled"); break;
|
case KKPS_DISABLED: name = _("Disabled"); break;
|
||||||
case KKPS_AFTER_T_KE: name = _("Cleared"); break;
|
case KKPS_AFTER_T_TE: name = _("Cleared"); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[200];
|
char buf[200];
|
||||||
|
|||||||
20
src/term.c
20
src/term.c
@@ -3689,7 +3689,7 @@ out_str_t_TE(void)
|
|||||||
|| modify_otherkeys_state == MOKS_DISABLED)
|
|| modify_otherkeys_state == MOKS_DISABLED)
|
||||||
modify_otherkeys_state = MOKS_DISABLED;
|
modify_otherkeys_state = MOKS_DISABLED;
|
||||||
else if (modify_otherkeys_state != MOKS_INITIAL)
|
else if (modify_otherkeys_state != MOKS_INITIAL)
|
||||||
modify_otherkeys_state = MOKS_AFTER_T_KE;
|
modify_otherkeys_state = MOKS_AFTER_T_TE;
|
||||||
|
|
||||||
// When the kitty keyboard protocol is enabled we expect t_TE to disable
|
// When the kitty keyboard protocol is enabled we expect t_TE to disable
|
||||||
// it. Remembering that it was detected to be enabled is useful in some
|
// it. Remembering that it was detected to be enabled is useful in some
|
||||||
@@ -3700,7 +3700,7 @@ out_str_t_TE(void)
|
|||||||
|| kitty_protocol_state == KKPS_DISABLED)
|
|| kitty_protocol_state == KKPS_DISABLED)
|
||||||
kitty_protocol_state = KKPS_DISABLED;
|
kitty_protocol_state = KKPS_DISABLED;
|
||||||
else
|
else
|
||||||
kitty_protocol_state = KKPS_AFTER_T_KE;
|
kitty_protocol_state = KKPS_AFTER_T_TE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int send_t_RK = FALSE;
|
static int send_t_RK = FALSE;
|
||||||
@@ -3892,8 +3892,18 @@ stoptermcap(void)
|
|||||||
out_flush();
|
out_flush();
|
||||||
termcap_active = FALSE;
|
termcap_active = FALSE;
|
||||||
|
|
||||||
// Output t_te first, it may switch between main and alternate screen,
|
// Output t_te before t_TE, t_te may switch between main and alternate
|
||||||
// and following codes may work on the active screen only.
|
// screen and following codes may work on the active screen only.
|
||||||
|
//
|
||||||
|
// When using the Kitty keyboard protocol the main and alternate screen
|
||||||
|
// use a separate state. If we are (or were) using the Kitty keyboard
|
||||||
|
// protocol and t_te is not empty (possibly switching screens) then
|
||||||
|
// output t_TE both before and after outputting t_te.
|
||||||
|
if (*T_TE != NUL && (kitty_protocol_state == KKPS_ENABLED
|
||||||
|
|| kitty_protocol_state == KKPS_DISABLED))
|
||||||
|
out_str_t_TE(); // probably disables the kitty keyboard
|
||||||
|
// protocol
|
||||||
|
|
||||||
out_str(T_TE); // stop termcap mode
|
out_str(T_TE); // stop termcap mode
|
||||||
cursor_on(); // just in case it is still off
|
cursor_on(); // just in case it is still off
|
||||||
out_str_t_TE(); // stop "raw" mode, modifyOtherKeys and
|
out_str_t_TE(); // stop "raw" mode, modifyOtherKeys and
|
||||||
@@ -5158,7 +5168,7 @@ handle_key_with_modifier(
|
|||||||
if (trail != 'u'
|
if (trail != 'u'
|
||||||
&& (kitty_protocol_state == KKPS_INITIAL
|
&& (kitty_protocol_state == KKPS_INITIAL
|
||||||
|| kitty_protocol_state == KKPS_OFF
|
|| kitty_protocol_state == KKPS_OFF
|
||||||
|| kitty_protocol_state == KKPS_AFTER_T_KE)
|
|| kitty_protocol_state == KKPS_AFTER_T_TE)
|
||||||
&& term_props[TPR_KITTY].tpr_status != TPR_YES)
|
&& term_props[TPR_KITTY].tpr_status != TPR_YES)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
|
|||||||
@@ -695,6 +695,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 */
|
||||||
|
/**/
|
||||||
|
1065,
|
||||||
/**/
|
/**/
|
||||||
1064,
|
1064,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user