From 5d8f65f311d31638ce36d6e22fd006c20ea84f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 17 Sep 2020 15:28:06 +0200 Subject: text: improve text_line_down on the last line of the file Fix #873 --- text-motions.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'text-motions.c') diff --git a/text-motions.c b/text-motions.c index 21967e5..1430d49 100644 --- 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); } -- cgit v1.2.3