summaryrefslogtreecommitdiff
path: root/src/fe-text
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-text')
-rw-r--r--src/fe-text/gui-readline.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c
index a9755318..851cbbe6 100644
--- a/src/fe-text/gui-readline.c
+++ b/src/fe-text/gui-readline.c
@@ -660,6 +660,8 @@ static gboolean paste_timeout(gpointer data)
static void paste_bracketed_end(int i, gboolean rest)
{
+ unichar last_char;
+
/* if there's stuff after the end bracket, save it for later */
if (rest) {
unichar *start = ((unichar *) paste_buffer->data) + i + G_N_ELEMENTS(bp_end);
@@ -672,6 +674,14 @@ static void paste_bracketed_end(int i, gboolean rest)
/* remove the rest, including the trailing sequence chars */
g_array_set_size(paste_buffer, i);
+ last_char = g_array_index(paste_buffer, unichar, i - 1);
+
+ if (paste_line_count > 0 && last_char != '\n' && last_char != '\r') {
+ /* there are newlines, but there's also stuff after the newline
+ * adjust line count to reflect this */
+ paste_line_count++;
+ }
+
/* decide what to do with the buffer */
paste_timeout(NULL);