Skip to content

Commit

Permalink
Merge pull request #81 from simeji/improve-rendering
Browse files Browse the repository at this point in the history
Improve performance
  • Loading branch information
simeji authored Mar 16, 2019
2 parents ab019bb + 19e3683 commit 1faeac4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"regexp"
"strings"

"github.com/mattn/go-runewidth"
"github.com/nsf/termbox-go"
runewidth "github.com/mattn/go-runewidth"
termbox "github.com/nsf/termbox-go"
"github.com/nwidger/jsoncolor"
)

Expand Down Expand Up @@ -55,6 +55,7 @@ func (t *Terminal) Draw(attr *TerminalDrawAttributes) error {
termbox.Clear(termbox.ColorDefault, termbox.ColorDefault)

y := t.defaultY
_, h := termbox.Size()

t.drawFilterLine(query, complete)

Expand All @@ -68,9 +69,13 @@ func (t *Terminal) Draw(attr *TerminalDrawAttributes) error {
}

for idx, cells := range cellsArr {
if i := idx - contentOffsetY; i >= 0 {
i := idx - contentOffsetY
if i >= 0 {
t.drawCells(0, i+y, cells)
}
if i > h {
break
}
}

termbox.SetCursor(len(t.prompt)+attr.CursorOffset, 0)
Expand Down

0 comments on commit 1faeac4

Please sign in to comment.