mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 14:14:17 +00:00
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.
This commit is contained in:
parent
2c71185ba6
commit
83eec3f833
1 changed files with 9 additions and 13 deletions
22
ui/ui.go
22
ui/ui.go
|
@ -70,6 +70,15 @@ const (
|
||||||
stateShowDocument
|
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
|
type keygenState int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -78,18 +87,6 @@ const (
|
||||||
keygenFinished
|
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 {
|
type model struct {
|
||||||
cc *charm.Client
|
cc *charm.Client
|
||||||
user *charm.User
|
user *charm.User
|
||||||
|
@ -267,7 +264,6 @@ func update(msg tea.Msg, mdl tea.Model) (tea.Model, tea.Cmd) {
|
||||||
|
|
||||||
case newCharmClientMsg:
|
case newCharmClientMsg:
|
||||||
m.cc = msg
|
m.cc = msg
|
||||||
m.state = stateShowStash
|
|
||||||
m.stash.cc = msg
|
m.stash.cc = msg
|
||||||
m.pager.cc = msg
|
m.pager.cc = msg
|
||||||
cmds = append(cmds, loadStash(m.stash), loadNews(m.stash))
|
cmds = append(cmds, loadStash(m.stash), loadNews(m.stash))
|
||||||
|
|
Loading…
Reference in a new issue