fix runes index out of range

pull/117/head
stephen cheng 6 years ago
parent a98834e508
commit e91e46ac10

@ -361,9 +361,13 @@ func printWithStyle(screen tcell.Screen, text string, x, y, maxWidth, align int,
width += w
start = index
}
if len(runes) > 0 {
for runewidth.RuneWidth(runes[start]) == 0 && start < len(runes) {
start++
}
}
return printWithStyle(screen, substring(start, len(runes)), x+maxWidth-width, y, width, AlignLeft, style)
} else if align == AlignCenter {
width := runewidth.StringWidth(strippedText)

Loading…
Cancel
Save