]> git.mdlowis.com Git - projs/tide.git/commitdiff
fixed a bug when executing 'Send' on multi-line chunks
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 18 Jul 2017 20:11:09 +0000 (16:11 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 18 Jul 2017 20:11:09 +0000 (16:11 -0400)
lib/pty.c

index 73e38648b4c0c627e3db52d7b807c1045786fbcd..d783d9cab753f71761965cfd2c012e47caf36333 100644 (file)
--- 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;
     }
 }