diff options
-rw-r--r-- | editors/vi.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/editors/vi.c b/editors/vi.c index 84da6db74..1fa97b568 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -1318,8 +1318,12 @@ static void colon(char *buf) | |||
1318 | q = begin_line(dot); // assume "dot" | 1318 | q = begin_line(dot); // assume "dot" |
1319 | } | 1319 | } |
1320 | // read after current line- unless user said ":0r foo" | 1320 | // read after current line- unless user said ":0r foo" |
1321 | if (b != 0) | 1321 | if (b != 0) { |
1322 | q = next_line(q); | 1322 | q = next_line(q); |
1323 | // read after last line | ||
1324 | if (q == end-1) | ||
1325 | ++q; | ||
1326 | } | ||
1323 | { // dance around potentially-reallocated text[] | 1327 | { // dance around potentially-reallocated text[] |
1324 | uintptr_t ofs = q - text; | 1328 | uintptr_t ofs = q - text; |
1325 | size = file_insert(fn, q, 0); | 1329 | size = file_insert(fn, q, 0); |