mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 06:04:18 +00:00
Also disable news if we're in local-only mode
This commit is contained in:
parent
dd9179a9ae
commit
15494e99b4
1 changed files with 8 additions and 2 deletions
10
ui/stash.go
10
ui/stash.go
|
@ -107,7 +107,7 @@ type stashModel struct {
|
|||
}
|
||||
|
||||
func (m stashModel) localOnly() bool {
|
||||
return m.general.cfg.DocumentTypes == LocalDocument
|
||||
return m.general.cfg.DocumentTypes^LocalDocument == 0
|
||||
}
|
||||
|
||||
func (m stashModel) stashedOnly() bool {
|
||||
|
@ -119,6 +119,12 @@ func (m stashModel) loadingDone() bool {
|
|||
return m.loaded == m.general.cfg.DocumentTypes
|
||||
}
|
||||
|
||||
// Returns whether or not we're online. That is, when "local-only" mode is
|
||||
// disabled and we've authenticated successfully.
|
||||
func (m stashModel) online() bool {
|
||||
return !m.localOnly() && m.general.authStatus == authOK
|
||||
}
|
||||
|
||||
func (m *stashModel) setSize(width, height int) {
|
||||
m.general.width = width
|
||||
m.general.height = height
|
||||
|
@ -613,7 +619,7 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd {
|
|||
|
||||
// Show news
|
||||
case "n":
|
||||
if m.general.authStatus == authFailed {
|
||||
if !m.online() {
|
||||
// If we're offline disable the news section
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue