Skip to content

Add ctrl navigation to cmux theme picker#60

Open
lawrencecchen wants to merge 1 commit into
issue-cmd-hover-path-rangefrom
issue-themes-broken-ctrl-np
Open

Add ctrl navigation to cmux theme picker#60
lawrencecchen wants to merge 1 commit into
issue-cmd-hover-path-rangefrom
issue-themes-broken-ctrl-np

Conversation

@lawrencecchen
Copy link
Copy Markdown

@lawrencecchen lawrencecchen commented May 19, 2026

Summary

  • Map Ctrl-N and Ctrl-P to one-row navigation in cmux-managed theme picker sessions.
  • Keep search-mode preview selection synced when using Ctrl-N and Ctrl-P.
  • Fix the keypad Page Down binding while touching the picker key handling.

Validation

  • Covered by the cmux regression test in Fix cmux themes ctrl navigation cmux#4366, which drives the bundled helper through a PTY and verifies the written theme config.
  • Red check failed before this Ghostty commit with Ctrl-N still applying the first theme.
  • Green check passed after this commit: tests/test_bundled_ghostty_theme_picker_helper.sh.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ada69cde-f676-46a8-89c2-4c801033106c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-themes-broken-ctrl-np

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 19, 2026

Greptile Summary

This PR adds Ctrl-N/Ctrl-P one-row navigation to the cmux theme picker in both normal and search modes, and fixes a pre-existing bug where vaxis.Key.kp_down appeared in the page-down handler instead of vaxis.Key.kp_page_down, which silently made keypad Page Down a dead key.

  • Normal mode: Ctrl-N and Ctrl-P are prepended as or conditions to the existing down/up key checks, keeping the logic symmetric with arrow-key and vim-key navigation.
  • Search mode: Ctrl-N/P handlers are inserted before text_input.update() and use break :search to skip the text-input update path, so the key is never inserted into the search buffer; the mode stays .search so the filter query is preserved.
  • Help overlay: Key binding strings updated to ^P, k, ↑ and ^N, j, ↓.

Confidence Score: 5/5

Safe to merge — the change is tightly scoped to key-event dispatch in the theme picker TUI and does not touch any file I/O, config writing, or network paths.

All three changes are consistent with the surrounding code patterns: Ctrl-N/P in normal mode follow the same if-chain style as existing navigation keys; the search-mode handlers correctly use break :search to skip text_input.update() and are ordered before the fall-through path; and the kp_page_down fix corrects a copy-paste error. down() and up() both guard against empty filtered lists, and applyCmuxSelectionForCurrentTheme() has its own early-return guard, so the new call sites are safe.

No files require special attention.

Important Files Changed

Filename Overview
src/cli/list_themes.zig Adds Ctrl-N/P navigation in both normal and search modes, fixes kp_down→kp_page_down bug in page-down handler, and updates help text strings.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    KP[Key Press received]
    KP --> ModeSwitch{self.mode}

    ModeSwitch --> Normal[".normal"]
    ModeSwitch --> SearchLabel["search: block"]

    Normal --> CtrlN_Norm{"Ctrl-N?"}
    CtrlN_Norm -- yes --> Down1_N["self.down(1)\napplyCmuxSelection()"]
    CtrlN_Norm -- no --> ArrowDown{"j / + / ↓ / kp_down / kp_add?"}
    ArrowDown -- yes --> Down1_N

    Normal --> CtrlP_Norm{"Ctrl-P?"}
    CtrlP_Norm -- yes --> Up1_N["self.up(1)\napplyCmuxSelection()"]
    CtrlP_Norm -- no --> ArrowUp{"k / - / ↑ / kp_up / kp_subtract?"}
    ArrowUp -- yes --> Up1_N

    Normal --> PgDown{"page_down / kp_page_down?\n[FIXED: was kp_down]"}
    PgDown -- yes --> Down20["self.down(20)\napplyCmuxSelection()"]

    SearchLabel --> ESC{"Escape?"}
    ESC -- yes --> Normal_mode["self.mode = .normal\nbreak :search"]
    ESC -- no --> CtrlN_S{"Ctrl-N?"}
    CtrlN_S -- yes --> Down1_S["self.down(1)\napplyCmuxSelection()\nbreak :search\n(stays in search mode)"]
    CtrlN_S -- no --> CtrlP_S{"Ctrl-P?"}
    CtrlP_S -- yes --> Up1_S["self.up(1)\napplyCmuxSelection()\nbreak :search\n(stays in search mode)"]
    CtrlP_S -- no --> TextInput["text_input.update()\nupdateFiltered()\napplyCmuxSelection()"]
Loading

Reviews (1): Last reviewed commit: "Add ctrl navigation to cmux theme picker" | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant