From 3b17b60578b8157eddbb8c7210bc68e91e27789c Mon Sep 17 00:00:00 2001 From: Marco Kirchner Date: Fri, 9 Sep 2016 15:47:20 +0200 Subject: [PATCH] texteditor: fix being able to select invalid line --- text.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/text.c b/text.c index 6101b842..19d124e0 100644 --- a/text.c +++ b/text.c @@ -370,7 +370,8 @@ int textViewer(char *file) { } else if (hold_buttons & SCE_CTRL_DOWN || hold2_buttons & SCE_CTRL_LEFT_ANALOG_DOWN) { if (offset_list[rel_pos + 1] < size) { if ((rel_pos + 1) < MAX_POSITION) { - rel_pos++; + if (base_pos + rel_pos < n_lines - 1) + rel_pos++; } else { if (offset_list[base_pos + rel_pos + 1] < size) { base_pos++;