From 83eec3f833c037d95a5f1d2f1217f86d33d1079a Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Mon, 20 Jul 2020 14:03:27 -0400 Subject: [PATCH] Don't change the state when initializing the Charm client This was residue from an earlier version in the application when it opened with a spinner rather than directly in the stash. It caused the pager to lock up and it's status bar to disappear if a local markdown file was opened before the Charm client initialized. --- ui/ui.go | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/ui/ui.go b/ui/ui.go index 428fcda..b71b277 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -70,6 +70,15 @@ const ( stateShowDocument ) +// String translates the staus to a human-readable string. This is just for +// debugging. +func (s state) String() string { + return [...]string{ + "showing stash", + "showing document", + }[s] +} + type keygenState int const ( @@ -78,18 +87,6 @@ const ( keygenFinished ) -// String translates the staus to a human-readable string. This is just for -// debugging. -func (s state) String() string { - return [...]string{ - "initializing", - "running keygen", - "keygen finished", - "showing stash", - "showing document", - }[s] -} - type model struct { cc *charm.Client user *charm.User @@ -267,7 +264,6 @@ func update(msg tea.Msg, mdl tea.Model) (tea.Model, tea.Cmd) { case newCharmClientMsg: m.cc = msg - m.state = stateShowStash m.stash.cc = msg m.pager.cc = msg cmds = append(cmds, loadStash(m.stash), loadNews(m.stash))