From fec4f00cf099a9b5bd54cad20c6cf4fe58a333cf Mon Sep 17 00:00:00 2001 From: Oliver <480930+rivo@users.noreply.github.com> Date: Tue, 2 Apr 2024 22:13:23 +0200 Subject: [PATCH] Handling end-of-text special case in TextArea.Select(). Fixes #958 --- textarea.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/textarea.go b/textarea.go index 50b34f1..e6452e3 100644 --- a/textarea.go +++ b/textarea.go @@ -714,7 +714,8 @@ RowLoop: length = -length } if start >= index+lineIndex && start < index+lineIndex+length-pos[1] || - end >= index+lineIndex && end < index+lineIndex+length-pos[1] { + end >= index+lineIndex && end < index+lineIndex+length-pos[1] || + next[0] == 1 && (start == t.length || end == t.length) { // Special case for the end of the text. break } lineIndex += length - pos[1] @@ -743,6 +744,7 @@ RowLoop: index += len(cluster) column += width } + row++ } if t.cursor.row < 0 {