From 610cb4094fb1cf7fb7e4c6857c0bad813e18a17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 24 Apr 2017 21:04:44 +0200 Subject: 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 --- vis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index 4a38903..bc488f6 100644 --- 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 */ } -- cgit v1.2.3