Skip to content

Commit 917d480

Browse files
committed
remove duplicated code
1 parent 939a7e1 commit 917d480

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

text/string.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -207,18 +207,7 @@ func RuneWidth(r rune) int {
207207
//
208208
// deprecated: use StringWidthWithoutEscSequences instead
209209
func RuneWidthWithoutEscSequences(str string) int {
210-
count, esp := 0, escSeqParser{}
211-
for _, c := range str {
212-
if esp.InSequence() {
213-
esp.Consume(c)
214-
continue
215-
}
216-
esp.Consume(c)
217-
if !esp.InSequence() {
218-
count += RuneWidth(c)
219-
}
220-
}
221-
return count
210+
return StringWidthWithoutEscSequences(str)
222211
}
223212

224213
// Snip returns the given string with a fixed length. For ex.:

0 commit comments

Comments
 (0)