From 9bc86c1944dbf377674218886b08f575fb3ff602 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Thu, 14 May 2020 15:41:17 -0400 Subject: [PATCH] Fix character-chomping weirdness with a well-placed newline --- ui/ui.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/ui/ui.go b/ui/ui.go index 4b73d87..6c68751 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -250,15 +250,12 @@ func view(mdl boba.Model) string { case stateKeygenFinished: s += spinner.View(m.spinner) + " Re-initializing..." case stateShowStash: - s += stashView(m.stash) + return stashView(m.stash) case stateShowDocument: - //return fmt.Sprintf("\n%s\n%s", statusBarView(m), pager.View(m.pager)) - return fmt.Sprintf("%s\n%s", pager.View(m.pager), statusBarView(m)) + return fmt.Sprintf("\n%s\n%s", pager.View(m.pager), statusBarView(m)) } - if m.state != stateShowStash && m.state != stateShowDocument { - s = "\n" + indent.String(s, 2) - } - return s + + return "\n" + indent.String(s, 2) } func statusBarView(m model) string { @@ -287,12 +284,11 @@ func statusBarView(m model) string { Background(statusBarBg.Color()). String() - emptySpace := te.String(" ").Background(statusBarBg.Color()).String() + // Empty space + emptyCell := te.String(" ").Background(statusBarBg.Color()).String() + emptySpace := strings.Repeat(emptyCell, m.terminalWidth-len(logoText)-len(noteText)-len(percentText)) - return logo + note + strings.Repeat( - emptySpace, - m.terminalWidth-len(logoText)-len(noteText)-len(percentText), - ) + percent + return logo + note + emptySpace + percent } // COMMANDS