diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-11 02:14:33 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-11 02:16:13 +0100 |
commit | 087227028f85db2fd5878caf87e3032302c95a30 (patch) | |
tree | 9ed59704bdb157d662a6f69db71894a4cd9827e5 /src/ips | |
parent | c4b421daf0a516852fc670826dceffb5c0d38ea8 (diff) | |
download | chawan-087227028f85db2fd5878caf87e3032302c95a30.tar.gz |
Fixes & QOL improvements
* fix infinite loop after closing buffer * fix setx not triggering hover updates * fix D not going back to PREV but to parent * add M-d, M-,, M-., M-/ for old D behavior, cycle through siblings, back to parent
Diffstat (limited to 'src/ips')
-rw-r--r-- | src/ips/socketstream.nim | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ips/socketstream.nim b/src/ips/socketstream.nim index 5d0485fa..e411956c 100644 --- a/src/ips/socketstream.nim +++ b/src/ips/socketstream.nim @@ -18,7 +18,13 @@ proc sockReadData(s: Stream, buffer: pointer, len: int): int = let s = SocketStream(s) if s.blk: while result < len: - result += s.source.recv(cast[pointer](cast[int](buffer) + result), len - result) + let n = s.source.recv(cast[pointer](cast[int](buffer) + result), len - result) + result += n + if n == 0: + raise newException(EOFError, "") + if n < 0: + result = n + break else: result = s.source.recv(buffer, len) if result < 0: @@ -37,7 +43,10 @@ proc sockWriteData(s: Stream, buffer: pointer, len: int) = #TODO maybe don't block if blk is false? var i = 0 while i < len: - i += SocketStream(s).source.send(cast[pointer](cast[int](buffer) + i), len - i) + let n = SocketStream(s).source.send(cast[pointer](cast[int](buffer) + i), len - i) + if n < 0: + raise newException(IOError, $strerror(errno)) + i += n proc sockAtEnd(s: Stream): bool = SocketStream(s).isend |