Skip to content

Commit

Permalink
tui: use "q" and "l" to quit the linksmode
Browse files Browse the repository at this point in the history
  • Loading branch information
azimut committed Apr 26, 2023
1 parent 6b703c7 commit 38ac070
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/tui/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ var DefaultListKeyMap = list.KeyMap{
),

// Quitting.
Quit: key.NewBinding(
key.WithKeys("q", "esc"),
key.WithHelp("q", "quit"),
),
// Quit: key.NewBinding(
// key.WithKeys("q", "esc"),
// key.WithHelp("q", "quit"),
// ),
ForceQuit: key.NewBinding(key.WithKeys("ctrl+c")),
}

Expand Down
5 changes: 5 additions & 0 deletions internal/tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
)
m.list.KeyMap = DefaultListKeyMap
m.list.SetShowTitle(false)
m.list.DisableQuitKeybindings()
m.Viewport = viewport.Model{
Width: msg.Width,
Height: msg.Height,
Expand All @@ -105,6 +106,10 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
case tea.KeyMsg:
if m.onLinkScreen {
switch {
case key.Matches(msg, DefaultKeyMap.Links):
m.onLinkScreen = false
case key.Matches(msg, DefaultKeyMap.Quit):
m.onLinkScreen = false
case key.Matches(msg, DefaultKeyMap.LinksOpen):
i, ok := m.list.SelectedItem().(item)
if ok {
Expand Down

0 comments on commit 38ac070

Please sign in to comment.