From a9db94eece70c6449dce0f5d83d012eb7f9680fa Mon Sep 17 00:00:00 2001 From: hamid-husain Date: Sat, 11 Apr 2026 08:17:15 +0530 Subject: [PATCH] Fix infinite loop in wordLeft when at buffer start --- textarea/textarea.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/textarea/textarea.go b/textarea/textarea.go index f0c0ca54..92d75094 100644 --- a/textarea/textarea.go +++ b/textarea/textarea.go @@ -954,6 +954,11 @@ func (m *Model) characterLeft(insideLine bool) { // cursor blink should be reset. If input is masked, move input to the start // so as not to reveal word breaks in the masked input. func (m *Model) wordLeft() { + // If we're already at the start, do nothing and return + if m.row == 0 && m.col == 0 { + return + } + for { m.characterLeft(true /* insideLine */) if m.col < len(m.value[m.row]) && !unicode.IsSpace(m.value[m.row][m.col]) {