Skip to content

Conversation

@Ashwinhegde19
Copy link

This PR addresses multiple keybinding regressions and conflicts reported in Issue #4997 to improve TUI usability across platforms.

Changes
Ctrl+C Handling (Windows/Linux): Modified the Prompt component to prioritize "Copy" when text is selected. If no text is selected, it falls back to "Clear Input" or "Exit App".

Conflict Resolution:
Remapped model_provider_list from Ctrl+A to Ctrl+Alt+M. This restores the standard Emacs/Readline behavior where Ctrl+A moves the cursor to the start of the line.

Navigation & Editing Defaults:
Added Ctrl+N (Next) and Ctrl+P (Previous) to both history navigation and vertical cursor movement.
Ensured Shift+Enter and Ctrl+Enter trigger a newline.
Ensured Ctrl+Left / Ctrl+Right trigger word-wise navigation.
Ensured Alt+D and Option+Delete trigger word-wise deletion.

Testing
Verified configuration loading and default values via unit tests.
Verified no remaining critical collisions in default keybinds.

google-labs-jules bot and others added 4 commits January 15, 2026 18:49
…ile.list

Resolves a critical vulnerability where symlinks could be used to access files outside the project directory.
Implemented `fs.promises.realpath` validation to ensure the actual target path is within the allowed scope.
Added regression test in `packages/opencode/test/security/symlink.test.ts`.
…ile.list

Resolves a critical vulnerability where symlinks could be used to access files outside the project directory.
Implemented `fs.promises.realpath` validation to ensure the actual target path is within the allowed scope.
Added regression test in `packages/opencode/test/security/symlink.test.ts`.

Fixes anomalyco#101
fix(security): prevent path traversal via symlinks
…lyco#4997)

- Fix Ctrl+C behavior on Windows: copies selection if present, otherwise clears/exits.
- Resolve Ctrl+A conflict: move `model_provider_list` to `ctrl+alt+m`.
- Fix Navigation: map `ctrl+n`/`ctrl+p` to move down/up and history next/prev.
- Fix Multiline: ensure `shift+return` is mapped to newline.
- Fix Word Navigation: ensure `ctrl+left`/`ctrl+right` are mapped.
- Fix Word Deletion: ensure `alt+d` and `option+delete` are mapped.
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found several related PRs that address TUI keybinding issues, but none appear to be duplicates of PR #8786. Here are the related PRs:

Related PRs (not duplicates):

  1. PR tui: align keybinds with standard terminal/readline/screen conventions #4268 - "tui: align keybinds with standard terminal/readline/screen conventions" - Broader keybinding alignment effort that may have similar goals but appears to be an older/separate initiative
  2. PR feat: add keybindings reference dialog to TUI #3888 - "feat: add keybindings reference dialog to TUI" - Feature addition for displaying keybindings, not a fix
  3. PR feat: require double Ctrl+C to exit when input is empty #6494 - "feat: require double Ctrl+C to exit when input is empty" - Related to Ctrl+C handling but focuses on exit behavior
  4. PR feat: add input_copy and input_cut keybindings for keyboard-based text selection #7520 - "feat: add input_copy and input_cut keybindings for keyboard-based text selection" - Related to text selection keybindings
  5. PR feat: add manual refresh shortcut for models in tui #5018 - "feat: add manual refresh shortcut for models in tui" - Different feature scope
  6. PR feat(tui): Allow keybinding of custom slash commands (resolves #5904) #5903 - "feat(tui): Allow keybinding of custom slash commands" - Different feature scope

None of these directly duplicate PR #8786's specific fixes for keybind conflicts and missing defaults related to issue #4997.

…lyco#4997)

- Fix Ctrl+C behavior on Windows: copies selection if present, otherwise clears/exits.
- Resolve Ctrl+A conflict: move `model_provider_list` to `ctrl+alt+m`.
- Fix Navigation: map `ctrl+n`/`ctrl+p` to move down/up and history next/prev.
- Fix Multiline: ensure `shift+return` is mapped to newline.
- Fix Word Navigation: ensure `ctrl+left`/`ctrl+right` are mapped.
- Fix Word Deletion: ensure `alt+d` and `option+delete` are mapped.
@LIHUA919
Copy link

Code review

Found 3 issues:

  1. Removed optional chaining operator causes runtime error (will crash when project.sandboxes is undefined/null)

const projects = await Promise.all(keys.map((x) => Storage.read<Info>(x)))
return projects.map((project) => ({
...project,
sandboxes: project.sandboxes.filter((x) => existsSync(x)),
}))
}

  1. Incorrect boolean logic in command filter (using || instead of && causes suggested items to be shown when they should be filtered out)

https://github.com/anomalyco/opencode/blob/892b6eb1e1daf6fb8cdece8fb06324db5cda9aa2/packages/app/src/context/command.tsx#L680-L686

  1. Keybinding conflict: both input_clear and input_copy default to ctrl+c, creating ambiguous behavior when no text is selected

agent_list: z.string().optional().default("<leader>a").describe("List agents"),
agent_cycle: z.string().optional().default("tab").describe("Next agent"),
agent_cycle_reverse: z.string().optional().default("shift+tab").describe("Previous agent"),
variant_cycle: z.string().optional().default("ctrl+t").describe("Cycle model variants"),
input_clear: z.string().optional().default("ctrl+c").describe("Clear input field"),
input_copy: z.string().optional().default("ctrl+c,super+c").describe("Copy from input"),
input_paste: z.string().optional().default("ctrl+v,super+v").describe("Paste from clipboard"),
input_submit: z.string().optional().default("return").describe("Submit input"),
input_newline: z

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants