From 7915e365b364af4c4287e35f4697f6e3cfe33284 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 31 Oct 2020 01:41:57 +0900 Subject: [PATCH] Prefer LightRenderer on Windows if it's available Fix #1766 --- src/terminal.go | 6 +++--- src/tui/dummy.go | 4 ---- src/tui/tcell.go | 4 ---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/terminal.go b/src/terminal.go index 778665a..eaf6e6b 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -408,11 +408,11 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal { var renderer tui.Renderer fullscreen := opts.Height.size == 0 || opts.Height.percent && opts.Height.size == 100 if fullscreen { - if tui.HasFullscreenRenderer() { - renderer = tui.NewFullscreenRenderer(opts.Theme, opts.Black, opts.Mouse) - } else { + if tui.IsLightRendererSupported() { renderer = tui.NewLightRenderer(opts.Theme, opts.Black, opts.Mouse, opts.Tabstop, opts.ClearOnExit, true, func(h int) int { return h }) + } else { + renderer = tui.NewFullscreenRenderer(opts.Theme, opts.Black, opts.Mouse) } } else { maxHeightFunc := func(termHeight int) int { diff --git a/src/tui/dummy.go b/src/tui/dummy.go index ca50e65..f78a1c2 100644 --- a/src/tui/dummy.go +++ b/src/tui/dummy.go @@ -6,10 +6,6 @@ package tui type Attr int -func HasFullscreenRenderer() bool { - return false -} - func (a Attr) Merge(b Attr) Attr { return a | b } diff --git a/src/tui/tcell.go b/src/tui/tcell.go index 4f80d06..3fd8132 100644 --- a/src/tui/tcell.go +++ b/src/tui/tcell.go @@ -15,10 +15,6 @@ import ( "github.com/mattn/go-runewidth" ) -func HasFullscreenRenderer() bool { - return true -} - func (p ColorPair) style() tcell.Style { style := tcell.StyleDefault return style.Foreground(tcell.Color(p.Fg())).Background(tcell.Color(p.Bg()))