From 1119ba0d256c5d0659db164bd73b6962376cfd1b Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sat, 4 Jul 2020 01:08:35 +0300 Subject: [PATCH] expand tab characters to spaces --- ui.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui.go b/ui.go index c240c72..dbbed05 100644 --- a/ui.go +++ b/ui.go @@ -153,7 +153,11 @@ func (win *win) print(x, y int, fg, bg termbox.Attribute, s string) (termbox.Att i += w - 1 if r == '\t' { - x += gOpts.tabstop - (x-off)%gOpts.tabstop + s := gOpts.tabstop - (x-off)%gOpts.tabstop + for i := 0; i < s && x+i < win.w; i++ { + termbox.SetCell(win.x+x+i, win.y+y, ' ', fg, bg) + } + x += s } else { x += runewidth.RuneWidth(r) }