Skip to content

Commit

Permalink
🐛 Allow options to focus and blur
Browse files Browse the repository at this point in the history
Options component was missing the ability to focus and blur.
  • Loading branch information
mikelorant committed Mar 2, 2023
1 parent faa5c76 commit 7de80e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/ui/option/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Model struct {
Panel Panel

state *commit.State
focus bool
section section.Model
setting setting.Model
help help.Model
Expand Down Expand Up @@ -226,6 +227,15 @@ func (m Model) View() string {
return lipgloss.JoinHorizontal(lipgloss.Top, section, settingHelp)
}

func (m *Model) Focus() {
m.focus = true
}

func (m *Model) Blur() {
m.focus = false
}


func (m *Model) SetSettings(set []section.Setting) {
m.section.Settings = set
}
Expand Down
2 changes: 2 additions & 0 deletions internal/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ func (m Model) resetModels() Model {
m.models.footer.Author = m.models.info.Author
m.models.footer.Signoff = m.signoff
m.models.help.Blur()
m.models.option.Blur()

return m
}
Expand Down Expand Up @@ -398,6 +399,7 @@ func (m Model) setModels() Model {
m.models.help.Focus()
case optionComponent:
m.models.status.Shortcuts = status.OptionShortcuts()
m.models.option.Focus()
}

if m.signoff {
Expand Down

0 comments on commit 7de80e4

Please sign in to comment.