aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-04-24 21:04:44 +0200
committerMarc André Tanner <mat@brain-dump.org>2017-04-24 21:04:44 +0200
commit610cb4094fb1cf7fb7e4c6857c0bad813e18a17a (patch)
treee4e0d41f1c47e741c4124cddbf527823a5c6213e /vis.c
parent90184397cba235b212c0e230db0dbb6dfc8d0aba (diff)
downloadvis-610cb4094fb1cf7fb7e4c6857c0bad813e18a17a.tar.gz
vis-610cb4094fb1cf7fb7e4c6857c0bad813e18a17a.tar.xz
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 (limited to 'vis.c')
-rw-r--r--vis.c2
1 files changed, 1 insertions, 1 deletions
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 */
}