summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-05-10 01:52:10 +0200
committerSébastien Helleu <flashcode@flashtux.org>2020-05-10 10:07:53 +0200
commitd5e7cb2487cdcba1778f64413705143b7942506c (patch)
tree03adfe61f887e17cedc16b105550a345bfcb2190
parent1e2a8c4682a7e70f7d17ff0f64669ec25870119f (diff)
downloadweechat-d5e7cb2487cdcba1778f64413705143b7942506c.zip
core: Don't remove consecutive newlines when pasting
Relates to #1498
-rw-r--r--src/gui/curses/gui-curses-key.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/src/gui/curses/gui-curses-key.c b/src/gui/curses/gui-curses-key.c
index ccccae3f9..eef9c5aaf 100644
--- a/src/gui/curses/gui-curses-key.c
+++ b/src/gui/curses/gui-curses-key.c
@@ -547,29 +547,20 @@ gui_key_read_cb (const void *pointer, void *data, int fd)
for (i = 0; i < ret; i++)
{
- /*
- * add all chars, but ignore a newline ('\r' or '\n') after
- * another one)
- */
- if ((i == 0)
- || ((buffer[i] != '\r') && (buffer[i] != '\n'))
- || ((buffer[i - 1] != '\r') && (buffer[i - 1] != '\n')))
+ if (gui_key_paste_pending && (buffer[i] == 25))
{
- if (gui_key_paste_pending && (buffer[i] == 25))
- {
- /* ctrl-Y: accept paste */
- accept_paste = 1;
- }
- else if (gui_key_paste_pending && (buffer[i] == 14))
- {
- /* ctrl-N: cancel paste */
- cancel_paste = 1;
- }
- else
- {
- gui_key_buffer_add (buffer[i]);
- text_added_to_buffer = 1;
- }
+ /* ctrl-Y: accept paste */
+ accept_paste = 1;
+ }
+ else if (gui_key_paste_pending && (buffer[i] == 14))
+ {
+ /* ctrl-N: cancel paste */
+ cancel_paste = 1;
+ }
+ else
+ {
+ gui_key_buffer_add (buffer[i]);
+ text_added_to_buffer = 1;
}
}