fix: improve macos option-r input - #18
Conversation
There was a problem hiding this comment.
💡 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".
| zle -N _recall_search | ||
| bindkey "@RECALL_SEARCH_KEY@" _recall_search | ||
| if [[ $OSTYPE == darwin* ]]; then | ||
| bindkey '®' _recall_search |
There was a problem hiding this comment.
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 👍 / 👎.
| 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: |
There was a problem hiding this comment.
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 👍 / 👎.
背景
macOS 终端对
Option+R存在两种常见输入形式:Esc+r®TUI 在 shell widget 的命令替换环境中读取输入时,需要稳定使用控制终端。
改动
/dev/tty获取输入。®快捷键绑定。use-dev-tty输入后端。现在,无需任何单独配置就可以在 macOS 上使用
Option+R快捷键以代替其他系统的Alt+R。验证
我在本机进行了验证,iTerm2、Ghostty、Kitty 和 macOS Terminal.app 现在 均可在不进行额外配置的情况下使用
Option+R可打开 recall 搜索。自动验证:
手动验证:
Option+R可打开 recall 搜索。Option+R可打开 recall 搜索。Option+R可打开 recall 搜索。Option+R可打开 recall 搜索。提交:
188908b fix: improve macos option-r input