diff --git a/README.md b/README.md index b5de8cc..c5030cc 100644 --- a/README.md +++ b/README.md @@ -277,7 +277,8 @@ The short version - the [full reference is here](docs/keybindings.md). | Key | Action | |----------------------------------------|------------------------------------------------------| | `tab` / `shift+tab` | cycle panes | -| `↑↓` (`j`/`k`) · `pgup/pgdn` · `g`/`G` | move · page · first/last | +| `left` / `right` | resource list / main pane | +| `↑↓` · `pgup/pgdn` · `g`/`G` | move · page · first/last | | type (Resources focused) | instant kind filter · `esc` clears | | `f` | find: search every column of the open table | | `ctrl+p` | **search everything** - kinds and objects in one box | diff --git a/docs/keybindings.md b/docs/keybindings.md index 79119e0..b4398a1 100644 --- a/docs/keybindings.md +++ b/docs/keybindings.md @@ -6,8 +6,8 @@ |------------------------|-------------------------------------------------------------------------------------------------------------------------------| | `ctrl+c` | quit (always) | | `q` | quit (when not typing in a search box or prompt) | -| `tab` / `shift+tab` | cycle panes Resources → Main → Actions | -| `←` `h` / `→` | focus resource list / main pane | +| `tab` / `shift+tab` | cycle panes Resources → Main → command box | +| `←` / `→` | focus resource list (from the main pane) / main pane (from the list) | | `enter` / double-click | open the selected item — logs if it has them, else describe. On the Namespaces table it switches namespace and shows its pods | | `z` | zoom / restore main pane | | `esc` | close text view → restore zoom (in that order) | @@ -62,6 +62,10 @@ Ctrl, Alt and Shift. In iTerm2, WezTerm or Ghostty you can map Cmd+K to other way. The **Actions pane is not in the cycle**: every action already has a hotkey and a clickable row, so a tab stop there would lead nowhere. +`left` in the main pane goes straight to the resource list, and `right` or +`enter` there comes back. While the main pane is zoomed, `left` stays put: +the list is off screen. + Clicking a resource row or an action acts on it without moving focus. The Resources pane scrolls with the wheel **without changing what is selected** — scrolling is looking, not picking, so the main panel stays where you left @@ -69,9 +73,10 @@ it. The Actions pane does not scroll; it is never taller than its list. ## Resource list (left pane) -`tab` to focus it. Any printable key then filters the list; `↑↓` moves, -`enter` or `→` returns to the table, `esc` clears. The active filter appears -in the panel title, with the match counter in its top-right tag. +`left` from the main pane, or `tab`, focuses it. Any printable key then +filters the list; `↑↓` moves, `enter` or `→` returns to the table, `esc` +clears. The active filter appears in the panel title, with the match counter +in its top-right tag. `space` folds or unfolds the group under the cursor and `left` folds it; clicking a `▾`/`▸` header does either. Config, Storage and RBAC start folded. diff --git a/docs/ui.md b/docs/ui.md index 7155a0c..11cf98c 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -351,7 +351,9 @@ The pickers share a **Save** button reachable with `tab`. `tab` cycles **Resources → Main → command box** in layout order, and `shift+tab` walks it backwards. The prompt can also be entered with `/`, `:` -or a click, and left with esc. +or a click, and left with esc. `left` in the main pane goes straight to the +resource list and `right` or `enter` there comes back (not while zoomed: the +list is off screen). The **Actions pane is not in the cycle** — every action already has a hotkey and a clickable row, so a tab stop there would be a keystroke that leads diff --git a/internal/ui/commands.go b/internal/ui/commands.go index 7eaa755..21fe670 100644 --- a/internal/ui/commands.go +++ b/internal/ui/commands.go @@ -254,7 +254,7 @@ func Help() string { is open it scrolls the popup, never what is behind it RESOURCE LIST (left pane) - tab focus it + left / tab focus it (left from the main pane, unless zoomed) type to search any letters filter the list instantly; the active filter shows in the panel title. A search looks inside folded groups too. diff --git a/internal/ui/interaction_test.go b/internal/ui/interaction_test.go index 89e5d54..42a161f 100644 --- a/internal/ui/interaction_test.go +++ b/internal/ui/interaction_test.go @@ -121,6 +121,49 @@ func TestTabCycleReturnsToStart(t *testing.T) { } } +// Left takes the keyboard from the main pane to the resource list without a +// lap of tab, and right comes back. +func TestLeftFocusesTheResourceListAndRightComesBack(t *testing.T) { + m := newTestModel(t, mock.New("")) + dismissOnboarding(m) + m.focus = focusMain + + m.handleKey(tea.KeyMsg{Type: tea.KeyLeft}) + if m.focus != focusList { + t.Fatalf("left from the main pane landed on %v, want focusList", m.focus) + } + m.handleKey(tea.KeyMsg{Type: tea.KeyRight}) + if m.focus != focusMain { + t.Fatalf("right from the resource list landed on %v, want focusMain", m.focus) + } +} + +// Moving focus is not picking: the view open in the main pane stays open. +func TestLeftKeepsTheOpenView(t *testing.T) { + m := newTestModel(t, mock.New("")) + dismissOnboarding(m) + openLogs(t, m) + m.focus = focusMain + + m.handleKey(tea.KeyMsg{Type: tea.KeyLeft}) + if m.focus != focusList || m.mode != modeLogs { + t.Errorf("after left: focus %v, mode %v; want focusList with the log view still open", m.focus, m.mode) + } +} + +// Zoomed, the resource list is off screen, so left has nowhere to go. +func TestLeftWhileZoomedStaysInTheMainPane(t *testing.T) { + m := newTestModel(t, mock.New("")) + dismissOnboarding(m) + m.focus = focusMain + m.setZoomed(true) + + m.handleKey(tea.KeyMsg{Type: tea.KeyLeft}) + if m.focus != focusMain { + t.Errorf("left while zoomed landed on %v, want focusMain", m.focus) + } +} + // The resource pane is focusable again, and typing there filters the list. func TestResourcePaneIsFocusableAndFilters(t *testing.T) { m := newTestModel(t, mock.New("")) diff --git a/internal/ui/model.go b/internal/ui/model.go index 0774228..2e3ffa3 100644 --- a/internal/ui/model.go +++ b/internal/ui/model.go @@ -1588,6 +1588,13 @@ func (m *Model) handleKey(msg tea.KeyMsg) tea.Cmd { return m.focusNext(1) case "shift+tab": return m.focusNext(-1) + case "left": + // The arrow's way to the resource list, the mirror of "right" there. + // Zoomed, the list is off screen, so there is nowhere to go. "h" is + // not bound with it: docs/plan.md gives "h" to Helm's history. + if !m.zoomed { + m.focus = focusList + } case "T": m.themeIdx = (m.themeIdx + 1) % len(m.themes) m.toast = "theme → " + m.th().Name