Skip to content

Commit

Permalink
fix: tab stops
Browse files Browse the repository at this point in the history
maaslalani committed Mar 29, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent a7c6060 commit 5039d19
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion ansi.go
Original file line number Diff line number Diff line change
@@ -48,7 +48,12 @@ func (p *dispatcher) Print(r rune) {
}

func (p *dispatcher) Execute(code byte) {
if code == 0x0A {
if code == '\t' {
for p.col%16 != 0 {
p.Print(' ')
}
}
if code == '\n' {
p.endBackground()
p.row++
p.col = 0
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -298,7 +298,7 @@ func main() {
}

if autoWidth {
longestLine := lipgloss.Width(strings.ReplaceAll(strippedInput, "\t", " "))
longestLine := lipgloss.Width(strings.ReplaceAll(strippedInput, "\t", " "))
terminalWidth = float64(longestLine+1) * (config.Font.Size / fontHeightToWidthRatio)
terminalWidth *= scale
terminalWidth += hPadding

0 comments on commit 5039d19

Please sign in to comment.