Skip to content

Commit

Permalink
Fixed wrong place for slice check
Browse files Browse the repository at this point in the history
  • Loading branch information
noborus committed Jul 6, 2023
1 parent 68c01a3 commit 892cc3d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions guesswidth.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ func lookupBlanks(line string) []int {
func countBlanks(blanks []int, line string) []int {
n := 0
for _, r := range line {
if n >= len(blanks) {
break
}
if r == ' ' && blanks[n] > 0 {
blanks[n] += 1
}
Expand All @@ -269,9 +272,6 @@ func countBlanks(blanks []int, line string) []int {
if runewidth.RuneWidth(r) == 2 {
n += 1
}
if n >= len(blanks) {
break
}
}
return blanks
}
Expand Down

0 comments on commit 892cc3d

Please sign in to comment.