vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit ce9aee8b1b8162809b4b04666af05343294d8b86
parent 2442d9330b417b9f704163c5778116dab599ec95
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Fri, 23 Oct 2020 11:38:02 +0200

text/core: add basic undo/redo sanity check for empty file

Diffstat:
Mcore/text-test.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/core/text-test.c b/core/text-test.c @@ -194,6 +194,10 @@ int main(int argc, char *argv[]) { ok(text_iterator_byte_get(&it, &b) && b == '\0' && text_iterator_valid(&it), "Accessing iterator after moving back from beyond start of file"); + ok(text_state(txt) > 0, "State on empty file"); + ok(text_undo(txt) == EPOS && isempty(txt), "Undo on empty file"); + ok(text_redo(txt) == EPOS && isempty(txt), "Redo on empty file"); + char data[] = "a\nb\nc\n"; size_t data_len = strlen(data); ok(insert(txt, 0, data), "Inserting new lines");