Skip to content

fix: xonsh: Refactor space appending logic in action.go#1208

Merged
rsteube merged 1 commit intocarapace-sh:masterfrom
anki-code:patch-1
Apr 26, 2026
Merged

fix: xonsh: Refactor space appending logic in action.go#1208
rsteube merged 1 commit intocarapace-sh:masterfrom
anki-code:patch-1

Conversation

@anki-code
Copy link
Copy Markdown
Contributor

@anki-code anki-code commented Apr 26, 2026

Hi! I've got the issue request from xonsh shell user but I see that the issue is on carapace side.

Before

exec($(carapace _carapace xonsh))
cd /tmp
mkdir -p 'foo bar/1/2'
ls foo<Tab>  # carapace
ls 'foo bar' <cursor>  # space after completion and next Tab is not working to go to subdirectory 🔴 

After

ls foo<Tab>  # carapace
ls 'foo bar'<cursor>  #  no space after completion and next Tab is working to go to dubdirectory 🟢 
ls 'foo bar/1'

Fix

Decide whether a trailing space is wanted BEFORE wrapping the value in quotes. Nospace is a SuffixMatcher and inspects the last rune of the value (e.g. "/" for directories, "=" for flags expecting a value). If we ran this check after quoting, the value would end with "'" and the match would always fail, causing a trailing space to be appended for paths like "foo bar/" -- the cursor would land after the space and tab completion of the next path part would be impossible.

@rsteube rsteube merged commit 11fe3c4 into carapace-sh:master Apr 26, 2026
35 of 36 checks passed
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