From 43b9953c8078475fc64c60509e8a6d2e42d40b34 Mon Sep 17 00:00:00 2001 From: sloumdrone Date: Fri, 31 May 2019 22:34:59 -0700 Subject: [PATCH] Clarifying comment --- cui/screen.go | 17 +++++++++++------ main.go | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cui/screen.go b/cui/screen.go index cb2ba53..2db53bc 100644 --- a/cui/screen.go +++ b/cui/screen.go @@ -39,7 +39,6 @@ func (s *Screen) AddMsgBar(row int, title, msg string, showTitle bool) { // DrawAllWindows loops over every window in the Screen struct and // draws it to screen in index order (smallest to largest) func (s Screen) DrawAllWindows() { - // s.Clear() for _, w := range s.Windows { if w.Show { w.DrawWindow() @@ -56,6 +55,15 @@ func (s Screen) Clear() { } } +// Clears message/error/command area +func (s *Screen) ClearCommandArea() { + MoveCursorTo(s.Height-1, 1) + Clear("line") + MoveCursorTo(s.Height, 1) + Clear("line") + MoveCursorTo(s.Height-1, 1) +} + // ReflashScreen checks for a screen resize and resizes windows if // needed then redraws the screen. It takes a bool to decide whether // to redraw the full screen or just the content. On a resize @@ -64,12 +72,9 @@ func (s *Screen) ReflashScreen(clearScreen bool) { if clearScreen { s.DrawAllWindows() s.DrawMsgBars() + s.ClearCommandArea() } else { - for _, w := range s.Windows { - if w.Show { - w.DrawWindow() - } - } + s.DrawAllWindows() } } diff --git a/main.go b/main.go index dd6fe5f..015fe78 100644 --- a/main.go +++ b/main.go @@ -471,6 +471,7 @@ func handleResize() { screen.DrawAllWindows() screen.DrawMsgBars() + screen.ClearCommandArea() } }