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 22:54:43 +0100
committerailin-nemui <ailin-nemui@users.noreply.github.com>2016-03-22 22:54:43 +0100
commit3bc8afa740fdf775022c9fd3d92b2dfcb3c9804e (patch)
treeb2cb84958ba0beb7c37428a2b708e8b827c81a98 /src/fe-text/terminfo-core.c
parentd36d34fe0432fc24d75791f2aba9e626a535f478 (diff)
parent35d255fc8c2bc585bacbe59afb8cf9c6cc3cadc8 (diff)
downloadirssi-3bc8afa740fdf775022c9fd3d92b2dfcb3c9804e.zip
Merge pull request #458 from ailin-nemui/fix_449
Properly toggle bracketed paste mode on stop/cont
Diffstat (limited to 'src/fe-text/terminfo-core.c')
-rw-r--r--src/fe-text/terminfo-core.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c
index 60927f1a..086c8801 100644
--- a/src/fe-text/terminfo-core.c
+++ b/src/fe-text/terminfo-core.c
@@ -395,6 +395,14 @@ static void _ignore_parm(TERM_REC *term, int param)
{
}
+static void term_dec_set_bracketed_paste_mode(int enable)
+{
+ if (enable)
+ tputs("\e[?2004h", 0, term_putchar);
+ else
+ tputs("\e[?2004l", 0, term_putchar);
+}
+
static void term_fill_capabilities(TERM_REC *term)
{
int i, ival;
@@ -535,6 +543,9 @@ void terminfo_cont(TERM_REC *term)
if (term->TI_smkx)
tput(tparm(term->TI_smkx));
+ if (term->bracketed_paste_enabled)
+ term_dec_set_bracketed_paste_mode(TRUE);
+
terminfo_input_init(term);
}
@@ -545,6 +556,9 @@ void terminfo_stop(TERM_REC *term)
/* move cursor to bottom of the screen */
terminfo_move(0, term->height-1);
+ if (term->bracketed_paste_enabled)
+ term_dec_set_bracketed_paste_mode(FALSE);
+
/* stop cup-mode */
if (term->TI_rmcup)
tput(tparm(term->TI_rmcup));
@@ -677,6 +691,15 @@ static int term_setup(TERM_REC *term)
return 1;
}
+void term_set_bracketed_paste_mode(int enable)
+{
+ if (current_term->bracketed_paste_enabled == enable)
+ return;
+
+ current_term->bracketed_paste_enabled = enable;
+ term_dec_set_bracketed_paste_mode(enable);
+}
+
TERM_REC *terminfo_core_init(FILE *in, FILE *out)
{
TERM_REC *old_term, *term;