Skip to content

Fix zsh Tab acceptance in shell-ready wrappers#1125

Closed
heyramzi wants to merge 3 commits intostablyai:mainfrom
heyramzi:fix/tab-forward-char-shell-ready
Closed

Fix zsh Tab acceptance in shell-ready wrappers#1125
heyramzi wants to merge 3 commits intostablyai:mainfrom
heyramzi:fix/tab-forward-char-shell-ready

Conversation

@heyramzi
Copy link
Copy Markdown
Contributor

This updates Orca's generated zsh shell-ready wrapper so Tab binds to forward-char, matching the same accept path as the right arrow for shells using zsh-autosuggestions.\n\nChanges:\n- add a shared zsh shell-ready rcfile helper\n- use it in both daemon and local PTY shell-ready wrappers\n- export the helper through the PTY IPC layer for tests\n- add a regression test for the generated zsh rc content\n\nVerification:\n- pnpm -C /Users/ramzi/Studio/orca typecheck:node\n- pnpm -C /Users/ramzi/Studio/orca test -- src/main/ipc/pty.test.ts (pulled in unrelated suites and hit pre-existing Electron/environment failures before the targeted test could be isolated)

@AmethystLiang AmethystLiang requested a review from nwparker April 27, 2026 03:33
@AmethystLiang
Copy link
Copy Markdown
Contributor

@nwparker can help review.

@nwparker nwparker self-assigned this Apr 27, 2026
@nwparker
Copy link
Copy Markdown
Contributor

Thanks for digging into this. After checking Tabby, WaveTerm, and VS Code, I don’t think they solve this at the terminal-emulator/xterm layer. They generally pass Tab through to the shell unless their own focus/keybinding policy consumes it.

This is something users can resolve in their zsh config today. For zsh-autosuggestions, the simple version is:

# ~/.zshrc, after zsh-autosuggestions is loaded
bindkey '^I' autosuggest-accept

A safer version that preserves normal Tab completion when no inline suggestion is visible is:

# ~/.zshrc, after zsh-autosuggestions is loaded

_orca_tab_accept_suggestion_or_complete() {
  if [[ -n "$POSTDISPLAY" ]] && (( $+widgets[autosuggest-accept] )); then
    zle autosuggest-accept
  else
    zle expand-or-complete
  fi
}

zle -N _orca_tab_accept_suggestion_or_complete
bindkey '^I' _orca_tab_accept_suggestion_or_complete

That should work in Orca as well as Tabby/WaveTerm, because Tab reaches zsh as ^I.

Given that, I’m leaning against taking a broad Orca default here, especially if it binds ^I directly to forward-char. That changes stock zsh Tab behavior and can override a user’s completion setup after their .zshrc has loaded. If we do decide to make Orca opinionated here, I think it should be a conservative zsh widget that only accepts when POSTDISPLAY is non-empty and otherwise delegates to the user’s existing Tab binding.

@nwparker
Copy link
Copy Markdown
Contributor

Closing for now, but happy to re-open the dicussion!

@nwparker nwparker closed this Apr 30, 2026
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.

3 participants