diff --git a/ui.go b/ui.go index da93dfb..7912085 100644 --- a/ui.go +++ b/ui.go @@ -836,22 +836,24 @@ func (ui *ui) draw(nav *nav) { ui.drawStatLine(nav) ui.screen.HideCursor() case ">": - pos := min(runeSliceWidth(ui.cmdAccLeft), ui.msgWin.w-len(ui.cmdPrefix)-1) + prefix := ui.cmdPrefix[:min(ui.msgWin.w-1, len(ui.cmdPrefix))] + pos := min(runeSliceWidth(ui.cmdAccLeft), ui.msgWin.w-len(prefix)-1) left := ui.cmdAccLeft[runeSliceWidth(ui.cmdAccLeft)-pos:] 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)+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) + ui.msgWin.printLine(ui.screen, 0, 0, st, prefix) + ui.msgWin.print(ui.screen, len(prefix), 0, st, ui.msg) + ui.msgWin.print(ui.screen, len(prefix)+printLength(ui.msg), 0, st, string(left)) + ui.msgWin.print(ui.screen, len(prefix)+printLength(ui.msg)+runeSliceWidth(left), 0, st, string(right)) + ui.screen.ShowCursor(ui.msgWin.x+len(prefix)+printLength(ui.msg)+runeSliceWidth(left), ui.msgWin.y) default: - pos := min(runeSliceWidth(ui.cmdAccLeft), ui.msgWin.w-len(ui.cmdPrefix)-1) + prefix := ui.cmdPrefix[:min(ui.msgWin.w-1, len(ui.cmdPrefix))] + pos := min(runeSliceWidth(ui.cmdAccLeft), ui.msgWin.w-len(prefix)-1) left := ui.cmdAccLeft[runeSliceWidth(ui.cmdAccLeft)-pos:] right := ui.cmdAccRight - ui.msgWin.printLine(ui.screen, 0, 0, st, ui.cmdPrefix) - ui.msgWin.print(ui.screen, len(ui.cmdPrefix), 0, st, string(left)) - ui.msgWin.print(ui.screen, len(ui.cmdPrefix)+runeSliceWidth(left), 0, st, string(right)) - ui.screen.ShowCursor(ui.msgWin.x+len(ui.cmdPrefix)+runeSliceWidth(left), ui.msgWin.y) + ui.msgWin.printLine(ui.screen, 0, 0, st, prefix) + ui.msgWin.print(ui.screen, len(prefix), 0, st, string(left)) + ui.msgWin.print(ui.screen, len(prefix)+runeSliceWidth(left), 0, st, string(right)) + ui.screen.ShowCursor(ui.msgWin.x+len(prefix)+runeSliceWidth(left), ui.msgWin.y) } if gOpts.preview {