vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 5c7f9ff15acb4fb52d24113c852277616bf43046
parent 439e0acd1ea97ba8a9d3b4f9ec0fed6180920176
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 17 Sep 2020 15:28:06 +0200

text: improve text_line_down on the last line of the file

Fix #873

Diffstat:
Mtext-motions.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/text-motions.c b/text-motions.c @@ -287,6 +287,8 @@ size_t text_line_up(Text *txt, size_t pos) { size_t text_line_down(Text *txt, size_t pos) { int width = text_line_width_get(txt, pos); size_t next = text_line_next(txt, pos); + if (next == text_size(txt)) + return pos; return text_line_width_set(txt, next, width); }