calculate rune widths properly in shell outputs

This commit is contained in:
Gokcehan 2021-05-30 17:35:44 +03:00
parent 5d439419ea
commit 599e42c12b

6
ui.go
View File

@ -840,9 +840,9 @@ func (ui *ui) draw(nav *nav) {
right := ui.cmdAccRight
ui.msgWin.printLine(ui.screen, 0, 0, st, ui.cmdPrefix)
ui.msgWin.print(ui.screen, len(ui.cmdPrefix), 0, st, ui.msg)
ui.msgWin.print(ui.screen, len(ui.cmdPrefix)+len(ui.msg), 0, st, string(left))
ui.msgWin.print(ui.screen, len(ui.cmdPrefix)+len(ui.msg)+runeSliceWidth(left), 0, st, string(right))
ui.screen.ShowCursor(ui.msgWin.x+len(ui.cmdPrefix)+len(ui.msg)+runeSliceWidth(left), ui.msgWin.y)
ui.msgWin.print(ui.screen, len(ui.cmdPrefix)+printLength(ui.msg), 0, st, string(left))
ui.msgWin.print(ui.screen, len(ui.cmdPrefix)+printLength(ui.msg)+runeSliceWidth(left), 0, st, string(right))
ui.screen.ShowCursor(ui.msgWin.x+len(ui.cmdPrefix)+printLength(ui.msg)+runeSliceWidth(left), ui.msgWin.y)
default:
pos := min(runeSliceWidth(ui.cmdAccLeft), ui.msgWin.w-len(ui.cmdPrefix)-1)
left := ui.cmdAccLeft[runeSliceWidth(ui.cmdAccLeft)-pos:]