Fix infinite loop in wordLeft when at buffer start

This commit is contained in:
hamid-husain 2026-04-11 08:17:15 +05:30
parent 204774bbee
commit a9db94eece

View File

@ -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]) {