Skip to content

Commit

Permalink
chore(textarea): lift an if condition into a parent loop
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Jul 17, 2024
1 parent c30c185 commit a9344b5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions textarea/textarea.go
Original file line number Diff line number Diff line change
Expand Up @@ -767,10 +767,7 @@ func (m *Model) wordRight() {

func (m *Model) doWordRight(fn func(charIdx int, pos int)) {
// Skip spaces forward.
for {
if m.col < len(m.value[m.row]) && !unicode.IsSpace(m.value[m.row][m.col]) {
break
}
for m.col >= len(m.value[m.row]) || unicode.IsSpace(m.value[m.row][m.col]) {
if m.row == len(m.value)-1 && m.col == len(m.value[m.row]) {
// End of text.
break
Expand Down

0 comments on commit a9344b5

Please sign in to comment.