summaryrefslogtreecommitdiff
path: root/src/fe-text
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-text')
-rw-r--r--src/fe-text/gui-entry.c3
-rw-r--r--src/fe-text/term-terminfo.c8
-rw-r--r--src/fe-text/terminfo-core.c23
-rw-r--r--src/fe-text/terminfo-core.h3
4 files changed, 28 insertions, 9 deletions
diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c
index 27778b2b..f275c235 100644
--- a/src/fe-text/gui-entry.c
+++ b/src/fe-text/gui-entry.c
@@ -582,7 +582,8 @@ void gui_entry_erase(GUI_ENTRY_REC *entry, int size, CUTBUFFER_UPDATE_OP update_
if (size == 0 || entry->pos < size)
return;
- if (entry->cutbuffer_len == 0) {
+ if (update_cutbuffer != CUTBUFFER_UPDATE_NOOP
+ && entry->cutbuffer_len == 0) {
update_cutbuffer = CUTBUFFER_UPDATE_REPLACE;
}
int cutbuffer_new_size = entry->cutbuffer_len + size;
diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c
index 3582b9e4..27be904e 100644
--- a/src/fe-text/term-terminfo.c
+++ b/src/fe-text/term-terminfo.c
@@ -710,11 +710,3 @@ void term_gets(GArray *buffer, int *line_count)
}
}
}
-
-void term_set_bracketed_paste_mode(int enable)
-{
- if (enable)
- tputs("\e[?2004h", 0, term_putchar);
- else
- tputs("\e[?2004l", 0, term_putchar);
-}
diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c
index 4db68cc7..aa833abf 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;
@@ -538,6 +546,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);
}
@@ -548,6 +559,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));
@@ -681,6 +695,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;
diff --git a/src/fe-text/terminfo-core.h b/src/fe-text/terminfo-core.h
index 21398791..0ef280a1 100644
--- a/src/fe-text/terminfo-core.h
+++ b/src/fe-text/terminfo-core.h
@@ -92,6 +92,9 @@ struct _TERM_REC {
/* Keyboard-transmit mode */
const char *TI_smkx;
const char *TI_rmkx;
+
+ /* Terminal mode states */
+ int bracketed_paste_enabled;
};
extern TERM_REC *current_term;