From 741a51f51331a9764cc4a2b4670b5718d3ccda4e Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 18 Jul 2017 16:11:09 -0400 Subject: [PATCH] fixed a bug when executing 'Send' on multi-line chunks --- lib/pty.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pty.c b/lib/pty.c index 73e3864..d783d9c 100644 --- a/lib/pty.c +++ b/lib/pty.c @@ -53,7 +53,8 @@ void pty_spawn(char** argv) { void pty_send(char* str) { if (!str) return; view_eof(win_view(EDIT), false); - bool has_eol = (str[strlen(str)-1] == '\n'); + size_t sz = strlen(str); + bool has_eol = (str[sz-1] == '\n'); while (*str) { Rune rune = 0; size_t length = 0; @@ -74,6 +75,7 @@ void pty_send_rune(Rune rune) { if (write(PtyFD, str, strlen(str)-1) < 0) PtyFD = -1; free(str); + win_buf(EDIT)->outpoint = pos; } } -- 2.49.0