From: Michael D. Lowis Date: Wed, 27 Nov 2019 03:38:18 +0000 (-0500) Subject: tweaked xpty input to only send input on newline at end of point X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=4fdda31b28ff756a350fbee68d82f9f50e3d6f5e;p=projs%2Ftide.git tweaked xpty input to only send input on newline at end of point --- diff --git a/TODO.md b/TODO.md index 6ca1f29..5a160d5 100644 --- 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 diff --git a/src/lib/xpty.c b/src/lib/xpty.c index f0141a7..8efac44 100644 --- a/src/lib/xpty.c +++ b/src/lib/xpty.c @@ -13,13 +13,11 @@ 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);