forked from aniani/vim
patch 9.0.1957: termcap options should change when setting keyprotocol
Problem: termcap options should change on keyprotocol setting Solution: Apply termcap entries when 'keyprotocol' changes When the 'keyprotocol' option was set after startup (including in a user's .vimrc) the termcap entries associated with the matching protocol were not applied. Thus, setting the option has no affect. When 'keyprotocol' is changed it should also update the termcap entries. closes: #13211 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Gregory Anders <greg@gpanders.com>
This commit is contained in:
committed by
Christian Brabandt
parent
28a23602e8
commit
3695d0e41b
27
src/term.c
27
src/term.c
@@ -1607,6 +1607,23 @@ apply_builtin_tcap(char_u *term, tcap_entry_T *entries, int overwrite)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Apply builtin termcap entries for a given keyprotocol.
|
||||
*/
|
||||
void
|
||||
apply_keyprotocol(char_u *term, keyprot_T prot)
|
||||
{
|
||||
if (prot == KEYPROTOCOL_KITTY)
|
||||
apply_builtin_tcap(term, builtin_kitty, TRUE);
|
||||
if (prot == KEYPROTOCOL_MOK2)
|
||||
apply_builtin_tcap(term, builtin_mok2, TRUE);
|
||||
|
||||
if (prot != KEYPROTOCOL_NONE)
|
||||
// Some function keys may accept modifiers even though the
|
||||
// terminfo/termcap entry does not indicate this.
|
||||
accept_modifiers_for_function_keys();
|
||||
}
|
||||
|
||||
/*
|
||||
* Parsing of the builtin termcap entries.
|
||||
* Caller should check if "term" is a valid builtin terminal name.
|
||||
@@ -2083,10 +2100,7 @@ set_termname(char_u *term)
|
||||
// Use the 'keyprotocol' option to adjust the t_TE and t_TI
|
||||
// termcap entries if there is an entry matching "term".
|
||||
keyprot_T kpc = match_keyprotocol(term);
|
||||
if (kpc == KEYPROTOCOL_KITTY)
|
||||
apply_builtin_tcap(term, builtin_kitty, TRUE);
|
||||
else if (kpc == KEYPROTOCOL_MOK2)
|
||||
apply_builtin_tcap(term, builtin_mok2, TRUE);
|
||||
apply_keyprotocol(term, kpc);
|
||||
|
||||
#ifdef FEAT_TERMGUICOLORS
|
||||
// There is no good way to detect that the terminal supports RGB
|
||||
@@ -2098,11 +2112,6 @@ set_termname(char_u *term)
|
||||
&& term_strings_not_set(KS_8U))
|
||||
apply_builtin_tcap(term, builtin_rgb, TRUE);
|
||||
#endif
|
||||
|
||||
if (kpc != KEYPROTOCOL_NONE)
|
||||
// Some function keys may accept modifiers even though the
|
||||
// terminfo/termcap entry does not indicate this.
|
||||
accept_modifiers_for_function_keys();
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user