Skip to content

Commit

Permalink
refactor(vt): dry: use cellbuf.TabStops
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Jan 27, 2025
1 parent abd7087 commit b7858a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 122 deletions.
119 changes: 0 additions & 119 deletions vt/tabstop.go

This file was deleted.

11 changes: 8 additions & 3 deletions vt/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type Terminal struct {
iconName, title string

// tabstop is the list of tab stops.
tabstops *TabStops
tabstops *cellbuf.TabStops

// The input buffer of the terminal.
buf bytes.Buffer
Expand Down Expand Up @@ -97,7 +97,7 @@ func NewTerminal(w, h int, opts ...Option) *Terminal {
t.parser.SetParamsSize(parser.MaxParamsSize)
t.parser.SetDataSize(1024 * 1024 * 4) // 4MB data buffer
t.resetModes()
t.tabstops = DefaultTabStops(w)
t.tabstops = cellbuf.DefaultTabStops(w)
t.fg = defaultFg
t.bg = defaultBg
t.cur = defaultCur
Expand Down Expand Up @@ -162,7 +162,7 @@ func (t *Terminal) Resize(width int, height int) {

t.scrs[0].Resize(width, height)
t.scrs[1].Resize(width, height)
t.tabstops = DefaultTabStops(width)
t.tabstops = cellbuf.DefaultTabStops(width)

t.setCursor(x, y)
}
Expand Down Expand Up @@ -297,3 +297,8 @@ func (t *Terminal) SetIndexedColor(i int, c color.Color) {

t.colors[i] = c
}

// resetTabStops resets the terminal tab stops to the default set.
func (t *Terminal) resetTabStops() {
t.tabstops = cellbuf.DefaultTabStops(t.Width())
}

0 comments on commit b7858a2

Please sign in to comment.