Skip to content

Commit a9344b5

Browse files
committed
chore(textarea): lift an if condition into a parent loop
1 parent c30c185 commit a9344b5

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

textarea/textarea.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -767,10 +767,7 @@ func (m *Model) wordRight() {
767767

768768
func (m *Model) doWordRight(fn func(charIdx int, pos int)) {
769769
// Skip spaces forward.
770-
for {
771-
if m.col < len(m.value[m.row]) && !unicode.IsSpace(m.value[m.row][m.col]) {
772-
break
773-
}
770+
for m.col >= len(m.value[m.row]) || unicode.IsSpace(m.value[m.row][m.col]) {
774771
if m.row == len(m.value)-1 && m.col == len(m.value[m.row]) {
775772
// End of text.
776773
break

0 commit comments

Comments
 (0)