]> git.mdlowis.com Git - projs/tide.git/commitdiff
tweaked xpty input to only send input on newline at end of point
authorMichael D. Lowis <mike@mdlowis.com>
Wed, 27 Nov 2019 03:38:18 +0000 (22:38 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Wed, 27 Nov 2019 03:38:18 +0000 (22:38 -0500)
TODO.md
src/lib/xpty.c

diff --git a/TODO.md b/TODO.md
index 6ca1f295ff1b459f424a23473fed396ee0b8be09..5a160d59022ffb1f614365aa95b097ce615af641 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -5,10 +5,8 @@
 ## STAGING
 
 * tide: implement hold mode and tag to enable/disable autoscroll
-* tide: only newline at end of point should send to subprocess
 * tide: point should be added to editlog to ensure undo/redo behave appropriately
 * tide: tab in point does fcomplete maybe?
-
 * fetch: don't exit on rulesets with no launch or exec rules
 * picktag: reimplement in C using binary search
 * fetch: add option to capture output of command
index f0141a72f60d6663e5a7099ea3499f1fbc6ebd5e..8efac44a3c307089c06fec038526e386308d4220 100644 (file)
 
 static View* EditView = NULL;
 static int Pty_Fd = -1;
-
-char ReadBuf[BUFFERSZ+1] = {0};
-char ArgsBuf[BUFFERSZ+1] = {0};
-char InputBuf[BUFFERSZ+1] = {0};
-ssize_t ArgsPos = 0;
-ssize_t InputPos = 0;
-
+static char ReadBuf[BUFFERSZ+1] = {0};
+static char ArgsBuf[BUFFERSZ+1] = {0};
+static char InputBuf[BUFFERSZ+1] = {0};
+static ssize_t ArgsPos = 0;
+static ssize_t InputPos = 0;
 static enum {
     READ_CHAR = 0,
     READ_ESC,
@@ -114,7 +112,7 @@ static void putb(int byte)
             read(Pty_Fd, &b, 1);
         }
     }
-    else if (byte == '\n' && buf_inpoint(&(EditView->buffer), EditView->buffer.selection.end-1))
+    else if (byte == '\n' && (EditView->buffer.selection.end == EditView->buffer.point.end))
     {
         /* get the input string and update the point */
         char* str = buf_getsat(&(EditView->buffer), EditView->buffer.point.beg, EditView->buffer.point.end);