mirror of
https://github.com/anotherhadi/spilltea.git
synced 2026-05-20 09:42:34 +02:00
Change help menus: Only display shortcuts used on the page
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -196,6 +196,7 @@ func (m *Model) refreshListViewport() {
|
||||
type pluginsKeyMap struct {
|
||||
editing bool
|
||||
hasConfig bool
|
||||
width int
|
||||
}
|
||||
|
||||
func (k pluginsKeyMap) ShortHelp() []key.Binding {
|
||||
@@ -210,11 +211,20 @@ func (k pluginsKeyMap) ShortHelp() []key.Binding {
|
||||
key.WithHelp(g.ScrollUp.Help().Key+"/"+g.ScrollDown.Help().Key, "scroll detail"),
|
||||
)
|
||||
if k.hasConfig {
|
||||
return []key.Binding{pk.Toggle, pk.EditConfig, pk.Filter, scrollHint}
|
||||
return []key.Binding{pk.Toggle, pk.EditConfig, pk.Filter, scrollHint, g.Help}
|
||||
}
|
||||
return []key.Binding{pk.Toggle, pk.Filter, scrollHint}
|
||||
return []key.Binding{pk.Toggle, pk.Filter, scrollHint, g.Help}
|
||||
}
|
||||
|
||||
func (k pluginsKeyMap) FullHelp() [][]key.Binding {
|
||||
return [][]key.Binding{k.ShortHelp()}
|
||||
g := keys.Keys.Global
|
||||
if k.editing {
|
||||
return [][]key.Binding{k.ShortHelp()}
|
||||
}
|
||||
pk := keys.Keys.Plugins
|
||||
pageGlobals := []key.Binding{g.Up, g.Down, g.ScrollUp, g.ScrollDown, g.Escape}
|
||||
all := []key.Binding{pk.Toggle, pk.EditConfig, pk.Filter}
|
||||
all = append(all, pageGlobals...)
|
||||
all = append(all, g.CommonBindings()...)
|
||||
return keys.ChunkByWidth(all, k.width)
|
||||
}
|
||||
|
||||
@@ -120,9 +120,9 @@ func (m *Model) renderStatusBar() string {
|
||||
escKey := keys.Keys.Global.Escape.Help().Key
|
||||
accent := lipgloss.NewStyle().Foreground(s.Primary)
|
||||
filterLine := pad.Render(accent.Render(filterKey) + " " + s.Bold.Render(m.filter) + s.Faint.Render(" "+escKey+" to clear"))
|
||||
return lipgloss.JoinVertical(lipgloss.Left, filterLine, pad.Render(m.help.View(pluginsKeyMap{editing: m.editing, hasConfig: m.hasConfig()})))
|
||||
return lipgloss.JoinVertical(lipgloss.Left, filterLine, pad.Render(m.help.View(pluginsKeyMap{editing: m.editing, hasConfig: m.hasConfig(), width: m.width})))
|
||||
}
|
||||
return pad.Render(m.help.View(pluginsKeyMap{editing: m.editing, hasConfig: m.hasConfig()}))
|
||||
return pad.Render(m.help.View(pluginsKeyMap{editing: m.editing, hasConfig: m.hasConfig(), width: m.width}))
|
||||
}
|
||||
|
||||
func (m *Model) renderList() string {
|
||||
|
||||
Reference in New Issue
Block a user