vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 200d8b02407490ef386afc36c04d7898d15e15c4 parent cdde2c6bb31e7ef2e389dd7efdb8018e5c9462c3 Author: Marc André Tanner <mat@brain-dump.org> Date: Fri, 20 Jan 2017 14:19:26 +0100 text: fix EOF handling for text_iterator_byte_next Handle zero length pieces gracefully. At some point we should write a comprehensive set of unit tests for the iterator API. Diffstat:
| M | text.c | | | 2 | +- |
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/text.c b/text.c @@ -1392,7 +1392,7 @@ bool text_iterator_byte_next(Iterator *it, char *b) { return false; it->text++; /* special case for advancement to EOF */ - if (it->text == it->end && !it->piece->next->text) { + if (it->pos+1 == it->piece->text->size) { it->pos++; if (b) *b = '\0';