vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit bc5ab38504921842811180bb0ce054e69a2e520b parent 307c6fe87bd3e77eaf40ab695d24af1a1264d586 Author: Marc André Tanner <mat@brain-dump.org> Date: Mon, 24 Apr 2017 21:04:44 +0200 vis: fix newline insertion at end of file With enabled auto indentation and tab expansion in an empty buffer, the following would insert one newline too many: i<Tab><Enter> Diffstat:
| M | vis.c | | | 2 | +- |
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vis.c b/vis.c @@ -1596,7 +1596,7 @@ size_t vis_text_insert_nl(Vis *vis, Text *txt, size_t pos) { text_insert(txt, pos, "\n", 1); if (eof) { if (nl2) - text_insert(txt, pos, "\n", 1); + text_insert(txt, text_size(txt), "\n", 1); else pos--; /* place cursor before, not after nl */ }