summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2020-05-09 18:23:33 +0200
committerSébastien Helleu <flashcode@flashtux.org>2020-05-09 18:23:33 +0200
commitf987e445ec173b8c033833feb25053e358260e49 (patch)
treedffbd5d63dc59ff77ecf6d7a30571b4fcc1ded3a /src/gui
parent63714855d3cbedc49747b099533a5a259cbd74c2 (diff)
downloadweechat-f987e445ec173b8c033833feb25053e358260e49.zip
core: properly display newlines in input when multiline is enabled in buffer (issue #984, issue #1063)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui-bar-item.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c
index 505b784ef..b7fda83ff 100644
--- a/src/gui/gui-bar-item.c
+++ b/src/gui/gui-bar-item.c
@@ -963,6 +963,21 @@ gui_bar_item_input_text_cb (const void *pointer, void *data,
}
}
+ /*
+ * if multiline is enabled in buffer, transform '\n' to '\r' to the
+ * newlines are displayed as real new lines instead of spaces
+ */
+ if (buffer->input_multiline)
+ {
+ ptr_input2 = ptr_input;
+ while (ptr_input2 && ptr_input2[0])
+ {
+ if (ptr_input2[0] == '\n')
+ ptr_input2[0] = '\r';
+ ptr_input2 = (char *)utf8_next_char (ptr_input2);
+ }
+ }
+
return ptr_input;
}