updated double-width display

This commit is contained in:
Josh Yan 2024-05-15 16:45:24 -07:00
parent 17b1e81ca1
commit c9e584fb90

View file

@ -745,6 +745,7 @@ func displayResponse(content string, wordWrap bool, state *displayResponseState)
if wordWrap && termWidth >= 10 { if wordWrap && termWidth >= 10 {
for _, ch := range content { for _, ch := range content {
if state.lineLength+1 > termWidth - 5 { if state.lineLength+1 > termWidth - 5 {
if runewidth.StringWidth(state.wordBuffer) > termWidth - 10 { if runewidth.StringWidth(state.wordBuffer) > termWidth - 10 {
fmt.Printf("%s%c", state.wordBuffer, ch) fmt.Printf("%s%c", state.wordBuffer, ch)
state.wordBuffer = "" state.wordBuffer = ""