summaryrefslogtreecommitdiff
path: root/src/fe-text/terminfo-core.c
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2016-03-22 16:54:34 +0100
committerailin-nemui <ailin-nemui@users.noreply.github.com>2016-03-22 23:58:34 +0100
commitb9914abbf3a7fae6d15f26650a98d8e74aa1fa05 (patch)
tree9c2112d05cb2e56dde10e1fd00e134f79a09d31c /src/fe-text/terminfo-core.c
parentb1ffd5f6472584aa3966746da9728c5afefcc4ce (diff)
downloadirssi-b9914abbf3a7fae6d15f26650a98d8e74aa1fa05.zip
Make use of terminal application keys configurable
adds a new setting term_appkey_mode which can enable or disable the use of keyboard transmit (application keys) mode. Fixes #430
Diffstat (limited to 'src/fe-text/terminfo-core.c')
-rw-r--r--src/fe-text/terminfo-core.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c
index aa833abf..15b00081 100644
--- a/src/fe-text/terminfo-core.c
+++ b/src/fe-text/terminfo-core.c
@@ -395,6 +395,12 @@ static void _ignore_parm(TERM_REC *term, int param)
{
}
+static void terminfo_set_appkey_mode(TERM_REC *term, int set)
+{
+ if (term->TI_smkx && term->TI_rmkx)
+ tput(tparm(set ? term->TI_smkx : term->TI_rmkx));
+}
+
static void term_dec_set_bracketed_paste_mode(int enable)
{
if (enable)
@@ -543,8 +549,8 @@ void terminfo_cont(TERM_REC *term)
if (term->TI_smcup)
tput(tparm(term->TI_smcup));
- if (term->TI_smkx)
- tput(tparm(term->TI_smkx));
+ if (term->appkey_enabled)
+ terminfo_set_appkey_mode(term, TRUE);
if (term->bracketed_paste_enabled)
term_dec_set_bracketed_paste_mode(TRUE);
@@ -566,8 +572,8 @@ void terminfo_stop(TERM_REC *term)
if (term->TI_rmcup)
tput(tparm(term->TI_rmcup));
- if (term->TI_rmkx)
- tput(tparm(term->TI_rmkx));
+ if (term->appkey_enabled)
+ terminfo_set_appkey_mode(term, FALSE);
/* reset input settings */
terminfo_input_deinit(term);
@@ -695,6 +701,15 @@ static int term_setup(TERM_REC *term)
return 1;
}
+void term_set_appkey_mode(int enable)
+{
+ if (current_term->appkey_enabled == enable)
+ return;
+
+ current_term->appkey_enabled = enable;
+ terminfo_set_appkey_mode(current_term, enable);
+}
+
void term_set_bracketed_paste_mode(int enable)
{
if (current_term->bracketed_paste_enabled == enable)