summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-11-15 15:56:33 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2015-11-15 15:56:33 +0100
commit281ef2e93ec60703183ca019d287032b25be2f75 (patch)
tree03a0a2a3eef070534b44d6eec79688a55e405849
parent9b22d72fd1adea33bbe77887bdde558c9132acd2 (diff)
downloadxK-281ef2e93ec60703183ca019d287032b25be2f75.tar.gz
xK-281ef2e93ec60703183ca019d287032b25be2f75.tar.xz
xK-281ef2e93ec60703183ca019d287032b25be2f75.zip
degesch: split input text at newlines
This makes pasting multiline text possible again.
-rw-r--r--degesch.c14
1 files 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);
}