Skip to content

fix: improve macos option-r input - #18

Merged
wendaining merged 1 commit into
wendaining:masterfrom
Kisechan:master
Sep 11, 2026
Merged

wendaining merged 1 commit into
wendaining:masterfrom
Kisechan:master

Conversation

@Kisechan

Copy link
Copy Markdown
Collaborator

背景

macOS 终端对 Option+R 存在两种常见输入形式:

  • Option-as-Alt 模式发送 Esc+r
  • 原生 macOS 输入发送 ®

TUI 在 shell widget 的命令替换环境中读取输入时,需要稳定使用控制终端。

改动

  • macOS 上让 TUI 通过 /dev/tty 获取输入。
  • 为 zsh、bash、fish 增加 macOS 原生 ® 快捷键绑定。
  • macOS 构建启用 Crossterm 的 use-dev-tty 输入后端。
  • 更新中英文 macOS 快捷键说明。
  • 添加 shell 初始化脚本的覆盖测试。

现在,无需任何单独配置就可以在 macOS 上使用 Option+R 快捷键以代替其他系统的 Alt+R

验证

我在本机进行了验证,iTerm2、Ghostty、Kitty 和 macOS Terminal.app 现在 均可在不进行额外配置的情况下使用 Option+R 可打开 recall 搜索。

自动验证:

cargo fmt --check
cargo test
cargo clippy --all-targets -- -D warnings
cargo build --release
zsh -n shell/recall.zsh
bash -n shell/recall.bash
fish -n shell/recall.fish

手动验证:

  • iTerm2:Option+R 可打开 recall 搜索。
  • Ghostty:Option+R 可打开 recall 搜索。
  • Kitty:Option+R 可打开 recall 搜索。
  • macOS Terminal.app:Option+R 可打开 recall 搜索。

提交:188908b fix: improve macos option-r input

@wendaining
wendaining merged commit f30e019 into wendaining:master Sep 11, 2026
5 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 188908b21f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shell/recall.zsh
zle -N _recall_search
bindkey "@RECALL_SEARCH_KEY@" _recall_search
if [[ $OSTYPE == darwin* ]]; then
bindkey '®' _recall_search

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor the configured key before binding Option-R

When a macOS user changes [ui].search_key to something such as ctrl-t or ctrl-x ctrl-r, this unconditional binding still maps ® to recall, so the configured key no longer fully controls the shortcut and the user cannot type that character normally. Only install the native Option-R binding when the configured semantic key is alt-r; the bash and fish integrations contain the same unconditional fallback.

Useful? React with 👍 / 👎.

Comment thread README.md
Comment on lines +178 to +181
Mac keyboards have no `Alt`; the equivalent is `Option` (`⌥`). recall accepts
both the native `Option+R` character (`®`) and the `Meta-R` sequence, so the
search widget works with the default macOS terminal settings. Option-as-Meta
keeps `Alt+R` compatible with terminal conventions:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Update the macOS setup and diagnostic guidance

This new claim conflicts with the actual first-party setup flows: install.sh lines 224-234 still tells macOS users that Option-R works only after enabling Option-as-Meta and defaults them to ctrl-x ctrl-r, while src/commands/doctor.rs lines 153-158 still reports an inserted ® as a terminal misconfiguration. Consequently fresh installs and diagnostics steer users away from the newly supported native binding; update those messages and the installer default together with this documentation.

Useful? React with 👍 / 👎.

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.

2 participants