From 281ef2e93ec60703183ca019d287032b25be2f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sun, 15 Nov 2015 15:56:33 +0100 Subject: [PATCH] degesch: split input text at newlines This makes pasting multiline text possible again. --- degesch.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/degesch.c b/degesch.c index ea7eaf6..f6706a1 100644 --- a/degesch.c +++ b/degesch.c @@ -8603,8 +8603,18 @@ process_input (struct app_context *ctx, char *user_input) if (!(input = iconv_xstrdup (ctx->term_to_utf8, user_input, -1, NULL))) print_error ("character conversion failed for `%s'", "user input"); else - // TODO: split at newlines? - (void) process_input_utf8 (ctx, ctx->current_buffer, input, 0); + { + struct str_vector lines; + str_vector_init (&lines); + + // XXX: this interprets commands in pasted text + split_str (input, "\r\n", &lines); + for (size_t i = 0; i < lines.len; i++) + (void) process_input_utf8 (ctx, + ctx->current_buffer, lines.vector[i], 0); + + str_vector_free (&lines); + } free (input); }