From 8e2e63f9b9e7fb2a9f4c58ebc18c5d8a0b4924fe Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 16 Jan 2017 12:06:54 +0900 Subject: [PATCH] Propertly fill window with background color Close #805 --- src/terminal.go | 5 +++++ src/tui/tui.go | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/terminal.go b/src/terminal.go index 4d207b4..2378984 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -558,6 +558,11 @@ func (t *Terminal) resizeWindows() { width, height, false) } + if !t.tui.IsOptimized() && t.theme != nil && t.theme.HasBg() { + for i := 0; i < t.window.Height(); i++ { + t.window.MoveAndClear(i, 0) + } + } } func (t *Terminal) move(y int, x int, clear bool) { diff --git a/src/tui/tui.go b/src/tui/tui.go index fd4a21e..c8bd5fb 100644 --- a/src/tui/tui.go +++ b/src/tui/tui.go @@ -175,6 +175,10 @@ type ColorTheme struct { Border Color } +func (t *ColorTheme) HasBg() bool { + return t.Bg != colDefault +} + type Event struct { Type int Char rune