Skip to content

Support Ctrl-N/Ctrl-P in cmux themes#4404

Closed
lawrencecchen wants to merge 2 commits into
issue-4355-cmux-themes-set-state-dependentfrom
followup-themes-ctrl-np
Closed

Support Ctrl-N/Ctrl-P in cmux themes#4404
lawrencecchen wants to merge 2 commits into
issue-4355-cmux-themes-set-state-dependentfrom
followup-themes-ctrl-np

Conversation

@lawrencecchen
Copy link
Copy Markdown
Contributor

@lawrencecchen lawrencecchen commented May 20, 2026

Summary

Why

  • Austin's PR fixes repeated cmux themes set reloads and interactive picker reload behavior.
  • This follow-up keeps the separate picker keybinding fix small: Ctrl-N moves down, Ctrl-P moves up, and Enter applies the highlighted theme.

Testing

  • ./tests/test_ci_ghosttykit_checksum_present.sh
  • GHOSTTY_SHA=176bd550f6fedd29e85cd92470e5dfadf295ebf7 GHOSTTYKIT_OUTPUT_DIR=/tmp/cmux-ghosttykit-followup-check ./scripts/download-prebuilt-ghosttykit.sh
  • ./tests/test_ci_ghosttykit_checksum_verification.sh
  • ./scripts/reload.sh --tag ctrlnp
  • CMUX_APP_PATH="$HOME/Library/Developer/Xcode/DerivedData/cmux-ctrlnp/Build/Products/Debug/cmux DEV ctrlnp.app" tests/test_bundled_ghostty_theme_picker_helper.sh

Regression Structure

  • First commit is test-only and fails before the Ghostty fix.
  • Second commit updates the Ghostty submodule pointer, GhosttyKit checksum, and fork docs.

Dogfood

  • Tagged build: ctrlnp.
  • In the tagged app, run cmux themes, press Ctrl-N, then Enter. Expected: selection moves down and applies that highlighted theme.
  • Run cmux themes again, press Ctrl-N then Ctrl-P, then Enter. Expected: selection returns up and applies that highlighted theme.

View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

Note

Medium Risk
Moderate risk because it updates the pinned ghostty fork artifact/checksum and relies on PTY-driven integration behavior, which can be brittle across environments.

Overview
Adds PTY-based regression coverage to ensure the bundled Ghostty theme picker helper supports Ctrl-N/Ctrl-P navigation and still writes/applies the highlighted theme on Enter.

Updates the pinned Ghostty fork reference/documentation and the GhosttyKit prebuilt checksum/release tag to the new fork head (176bd550f) that includes the Ctrl keybinding fix.

Reviewed by Cursor Bugbot for commit f283c43. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Adds Ctrl-N/Ctrl-P navigation to the cmux themes picker and verifies it end-to-end with PTY tests that assert the highlighted theme is applied. Updates the ghostty fork and pins the matching GhosttyKit release and checksum, with refreshed fork docs.

  • Bug Fixes

    • Support Ctrl-N (down) and Ctrl-P (up) in the cmux themes picker; Enter applies the highlighted theme.
    • Extend PTY tests to drive navigation, use an isolated XDG_CONFIG_HOME, and assert the expected theme is written.
  • Dependencies

    • Update ghostty and pin the matching GhosttyKit build/checksum; update fork docs with the new release tag.

Written for commit f283c43. Summary will update on new commits. Review in cubic

@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment May 20, 2026 1:18am
cmux-staging Building Building Preview, Comment May 20, 2026 1:18am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 88603e3f-3253-4192-9f0f-e5b26a95edc9

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 followup-themes-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.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 20, 2026

Greptile Summary

This PR advances the pinned Ghostty fork submodule to 176bd550f, which adds Ctrl-N/Ctrl-P one-row navigation to the cmux-managed theme picker, and updates the matching GhosttyKit checksum and fork documentation accordingly.

  • Ghostty submodule + checksum: pointer moved from ff6e1260d to 176bd550f; new SHA-256 entry appended to scripts/ghosttykit-checksums.txt and release tag documented in docs/ghostty-fork.md.
  • PTY regression tests: test_bundled_ghostty_theme_picker_helper.sh gains two new scenarios — Ctrl-N moves the selection down one row (asserts second_theme is written) and Ctrl-N + Ctrl-P round-trips back to the first row (asserts first_theme is written) — using a +list-themes --plain probe to determine expected theme names dynamically.
  • Test environment hardening: XDG_CONFIG_HOME is now isolated to a temp directory for all picker scenarios, preventing real user Ghostty config from influencing test results.

Confidence Score: 5/5

Safe to merge — no production Swift or runtime code is touched; changes are limited to a submodule bump, its matching checksum, documentation, and new PTY test scenarios.

The submodule advance, checksum update, and docs are consistent with each other and follow the established pattern in this repo. The new PTY test scenarios correctly exercise the Ctrl-N/Ctrl-P paths, use isolated XDG_CONFIG_HOME to avoid real-user-config contamination, and assert the exact theme name written to the config file. No production code paths are modified.

No files require special attention.

Important Files Changed

Filename Overview
tests/test_bundled_ghostty_theme_picker_helper.sh Adds PTY regression tests for Ctrl-N/Ctrl-P picker navigation; refactors env setup into helper_environment, enumerates themes via +list-themes --plain, and verifies exact theme name written for new nav paths.
docs/ghostty-fork.md Updates pinned fork head from ff6e1260d to 176bd550f, records the new release tag, branch, and Ctrl-N/Ctrl-P commit in the changelog table.
scripts/ghosttykit-checksums.txt Appends the SHA-256 checksum for the new Ghostty fork head 176bd550f; format is consistent with all prior entries.
ghostty Submodule pointer advanced from ff6e1260d to 176bd550f to pick up the Ctrl-N/Ctrl-P theme picker commit.

Sequence Diagram

sequenceDiagram
    participant Shell as test script (bash)
    participant Py as Python harness
    participant Helper as ghostty helper binary

    Shell->>Py: launch python3 heredoc
    Py->>Helper: +list-themes --plain (isolated XDG_CONFIG_HOME)
    Helper-->>Py: sorted theme list stdout
    Py->>Py: parse theme_names[0], theme_names[1]

    Note over Py,Helper: normal mode scenario
    Py->>Helper: pty.fork() + execve(+list-themes)
    Helper-->>Py: renders picker ("Enter apply" visible)
    Py->>Helper: write(b"\r")
    Helper-->>Py: exits 0, writes config_path

    Note over Py,Helper: Ctrl-N scenario
    Py->>Helper: pty.fork() + execve(+list-themes)
    Helper-->>Py: renders picker ("Enter apply" visible)
    Py->>Helper: write(b"\x0e\r")  [Ctrl-N, Enter]
    Helper-->>Py: exits 0, writes ctrl_n_config_path
    Py->>Py: assert_theme_written(second_theme)

    Note over Py,Helper: Ctrl-P scenario
    Py->>Helper: pty.fork() + execve(+list-themes)
    Helper-->>Py: renders picker ("Enter apply" visible)
    Py->>Helper: write(b"\x0e\x10\r")  [Ctrl-N, Ctrl-P, Enter]
    Helper-->>Py: exits 0, writes ctrl_p_config_path
    Py->>Py: assert_theme_written(first_theme)

    Py->>Shell: write results_path with all 4 config paths
    Shell->>Shell: grep-validate markers + theme line in each config
Loading

Reviews (2): Last reviewed commit: "fix: support ctrl navigation in cmux the..." | Re-trigger Greptile

Comment on lines +97 to +107
theme_names = sorted(
(
entry.name
for entry in os.scandir(theme_dir)
if entry.is_file() or entry.is_symlink()
),
key=lambda name: name.lower(),
)
if len(theme_names) < 2:
sys.stderr.write(f"FAIL: expected at least two bundled themes in {theme_dir}\n")
sys.exit(1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Theme name derivation assumes no file extension

os.scandir returns entry.name including any file extension. If the bundled themes directory ever contains files named ThemeName.ghostty instead of plain ThemeName, theme_names[0] and theme_names[1] would carry the .ghostty suffix, causing assert_theme_written to compare against theme = light:ThemeName.ghostty,dark:ThemeName.ghostty — a line the picker would never write — and the Ctrl-N/Ctrl-P assertions would always fail. The existing Ghostty bundled themes use bare names so this is currently safe, but an explicit os.path.splitext(entry.name)[0] (or entry.name.removesuffix(".ghostty")) would make the intent explicit and guard against a future themes-directory restructure.

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 4 files

Re-trigger cubic

@lawrencecchen lawrencecchen force-pushed the followup-themes-ctrl-np branch from 5827c1e to f283c43 Compare May 20, 2026 00:51
@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.

@lawrencecchen
Copy link
Copy Markdown
Contributor Author

Superseded by the main-targeted follow-up PR: #4474.

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