Skip to content

feat: sidebar toggle shortcut + configurable keyboard shortcuts - #49

Open
YapWH1208 wants to merge 4 commits into
omdsh-dev:mainfrom
YapWH1208:agent/sidebar-toggle-shortcut
Open

feat: sidebar toggle shortcut + configurable keyboard shortcuts#49
YapWH1208 wants to merge 4 commits into
omdsh-dev:mainfrom
YapWH1208:agent/sidebar-toggle-shortcut

Conversation

@YapWH1208

Copy link
Copy Markdown

What

Adds a keyboard shortcut to open/close the sidebar, and makes all three of the plugin's keyboard shortcuts user-configurable.

  • Sidebar toggle: default Ctrl/Cmd+B (Mod+B) flips the right panel from anywhere in the GUI. The chord yields to IME composition, to any handler that already claimed the event (defaultPrevented), to auto-repeat, and to the sidebar terminal (where Ctrl+B keeps its shell meaning: control char / tmux prefix).
  • Configurable shortcuts: the Side card settings page gains a "Keyboard shortcuts" group with one text row per shortcut — toggle sidebar, save editor, git commit. Chords persist in SidebarPrefs.shortcuts (validated + canonicalized) and apply live (toggle listener, CodeMirror keymap compartment, GitView commit).
  • Chord syntax: Mod+B, Ctrl+Shift+Enter, Cmd+S, … — Mod = Cmd on macOS, Ctrl elsewhere; at least one modifier required; named keys (Enter, Space, Tab, Escape, arrows, F1–F12, …) supported.
  • Tooltips (toggle button, save button, git commit placeholder) show the live chord; README (zh/en) documents defaults and where to rebind them.

Why

The sidebar previously could only be toggled by clicking, and the plugin's hard-coded shortcuts were not discoverable/configurable. User request: "add shortcut to open/close the sidebar" plus configurability for all available shortcuts.

Design

docs/plans/2026-08-14-shortcuts-design.md (repo-convention design doc incl. deviation log, review round, acceptance and security records).

Tests

  • New tests/shortcuts.spec.ts (34 tests): chord parse/canonical/display/match + CodeMirror key mapping matrix; toggle listener (session gating, terminal/.xterm protection, defaultPrevented/IME/repeat yields, pref-driven chords, platform quirk, disposer).
  • tests/unit.spec.ts: parsePrefs shortcuts-map validation/canonicalization + special-key hygiene.
  • tests/side-card-section-rows.spec.tsx: ShortcutRow interactive behavior (commit, invalid revert, Enter commit, failed-write remount).
  • Existing suites updated for the new prefs field.
  • pnpm typecheck ✓, pnpm build ✓, vitest: 441 passed; the only failures (22) are pre-existing node-pty spawn failures in smoke/agent-pty specs, reproduced identically on clean main (sandbox cannot spawn shells).

Review evidence

  • Independent code review (isolated subagent): REQUEST-CHANGES → all findings fixed in 3b313a2 (macOS Cmd+Shift quirk, commit-chord preventDefault, live commit placeholder, repeat/no-session handling, Mod+Ctrl/Cmd rejection, stale-merge fix, +regression tests).
  • Independent acceptance (isolated subagent): ACCEPT-WITH-NOTES — notes addressed (save tooltip live chord; no-input-guard documented as user-approved behavior; conflict detection explicitly out of scope).
  • Independent security audit (isolated subagent): LOW-RISK, no exploitable items — hardening applied in 797552c (special-key hygiene + test, cached platform detection, browser-conflict hint copy).

Risk / migration

  • No migration: shortcuts is an open map defaulting to {} (old settings documents resolve with defaults).
  • Behavior note: the git-commit default chord is now Mod+Enter (Cmd+Enter on macOS; previously both Ctrl and Cmd+Enter worked there) — rebindable in settings.
  • A user-configured chord can shadow browser defaults (e.g. Ctrl+W); the settings copy warns; conflict detection is intentionally out of scope (documented in the design doc).
  • No security impact: keybinding feature only; no new routes or permissions.

Validation

typecheck ✓ · vitest 441 passed (22 pre-existing pty-spawn failures on clean main) · build ✓ · git diff --check ✓

@YapWH1208
YapWH1208 force-pushed the agent/sidebar-toggle-shortcut branch from e34e4a4 to 04636fb Compare August 14, 2026 12:44
@YapWH1208
YapWH1208 force-pushed the agent/sidebar-toggle-shortcut branch from 04636fb to 4f9e829 Compare August 14, 2026 12:52
@YapWH1208
YapWH1208 marked this pull request as ready for review August 14, 2026 12:53
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

# Conflicts:
#	src/client/SideCardSection.tsx
#	src/client/prefs.ts
#	src/config.ts
#	src/prefs-shared.ts
#	tests/plugin-shape.spec.ts
#	tests/smoke.spec.ts
#	tests/unit.spec.ts
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