fix: expand shell variables in bash argPath for permission check (#740), allow leader keybinds when prompt focused (#674)#796
Open
MrRealORG wants to merge 1 commit into
Conversation
…rmission check (XiaomiMiMo#740), allow leader keybinds when prompt is focused (XiaomiMiMo#674) - Bash tool: argPath() now calls expand() for all shells (not just PowerShell), so paths like $HOME/dir are resolved before the external-directory permission check. Previously on bash, $HOME was left unexpanded, causing dynamic() to return true and skip the safety check entirely. - Command palette: leader-prefixed keybinds (e.g. <leader>down) are no longer blocked when the text input is focused. The text-editing key guard now exempts <leader> bindings so multi-key chords work while typing in the prompt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two targeted safety fixes in 2 files:
Fix #740 — Bash tool skips external directory permission for shell-variable paths
The
argPath()function inbash.tsonly calledexpand()(which resolves$HOME,$PWDetc.) for PowerShell. On bash, it only calledhome(unquote(arg))which handles~but not$HOME.Since the unexpanded text still contained
$,dynamic()returnedtrue, causing the entire external directory permission check to be skipped. This meant commands likerm -rf $HOME/projectnever triggered the directory permission prompt.Fix: Call
expand()for all shells, not just PowerShell. The function already handles both PowerShell ($env:X,${env:X}) and bash ($HOME,$PWD) patterns.Fix #674 — Leader-prefixed keybinds blocked when prompt is focused
In
dialog-command.tsx, the keyboard handler skips non-input keybinds when the text input is focused and the pressed key matches a text-editing key (like Down arrow). Leader-prefixed keybinds like<leader>down(Ctrl+X → Down) were caught by this guard because the Down key matchesinput_move_down.Fix: Add an exception for
<leader>-prefixed keybinds so multi-key chords work while the prompt is focused.Test Plan
$HOME/some-path— should trigger external directory permission prompt