summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/vi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 7b88e8e..77535be 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -1318,8 +1318,12 @@ static void colon(char *buf)
q = begin_line(dot); // assume "dot"
}
// read after current line- unless user said ":0r foo"
- if (b != 0)
+ if (b != 0) {
q = next_line(q);
+ // read after last line
+ if (q == end-1)
+ ++q;
+ }
{ // dance around potentially-reallocated text[]
uintptr_t ofs = q - text;
size = file_insert(fn, q, 0);