aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2020-09-17 15:28:06 +0200
committerMarc André Tanner <mat@brain-dump.org>2020-09-17 15:30:27 +0200
commit5d8f65f311d31638ce36d6e22fd006c20ea84f41 (patch)
tree2ab90e4cb163ad50bd3fce582d7932cf77f65b2a
parent31d6cee25636b4a51cd87103a393666f53f71360 (diff)
downloadvis-5d8f65f311d31638ce36d6e22fd006c20ea84f41.tar.gz
vis-5d8f65f311d31638ce36d6e22fd006c20ea84f41.tar.xz
text: improve text_line_down on the last line of the file
Fix #873
-rw-r--r--text-motions.c2
1 files changed, 2 insertions, 0 deletions
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);
}