From f987e445ec173b8c033833feb25053e358260e49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 9 May 2020 18:23:33 +0200 Subject: core: properly display newlines in input when multiline is enabled in buffer (issue #984, issue #1063) --- src/gui/gui-bar-item.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/gui') 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; } -- cgit v1.2.3