completions: rejoin bash words split at COMP_WORDBREAKS - #10213
Open
nikosavola wants to merge 1 commit into
Open
nikosavola wants to merge 1 commit into
nikosavola wants to merge 1 commit into
Conversation
nikosavola
enabled auto-merge
September 17, 2026 13:07
nikosavola
force-pushed
the
nikosavola/push-uqtwmmxrmkws
branch
from
September 17, 2026 13:41
f915be3 to
3581b12
Compare
josephlou5
reviewed
Sep 17, 2026
nikosavola
force-pushed
the
nikosavola/push-uqtwmmxrmkws
branch
from
September 17, 2026 15:52
3581b12 to
8c2311f
Compare
josephlou5
reviewed
Sep 17, 2026
nikosavola
force-pushed
the
nikosavola/push-uqtwmmxrmkws
branch
from
September 17, 2026 17:12
8c2311f to
6058e13
Compare
josephlou5
reviewed
Sep 18, 2026
nikosavola
force-pushed
the
nikosavola/push-uqtwmmxrmkws
branch
from
September 18, 2026 07:11
6058e13 to
1b93feb
Compare
Bash splits the word being completed at COMP_WORDBREAKS characters, which include @, :, and = by default, so dynamic completion of values like remote bookmarks (jj rebase -o main@<TAB>) received only fragments of the word and returned nothing. Revset ranges (main::<TAB>) and args containing = (git push --named a=<TAB>) were affected the same way. Wrap the generated bash completion function so that it rejoins the split words before handing them to the completer, and rebases the returned candidates on the part of the word that bash will actually replace. This is the approach git-completion.bash takes for its own word break characters; unlike the alternative of editing COMP_WORDBREAKS (and disabling bash's @-hostname completion, which would re-add @ there), it has no effect on the rest of the shell session. Fixes jj-vcs#7758
nikosavola
force-pushed
the
nikosavola/push-uqtwmmxrmkws
branch
from
September 18, 2026 07:12
1b93feb to
b4c0854
Compare
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.
Bash splits the word being completed at COMP_WORDBREAKS characters, which include @, :, and = by default, so dynamic completion of values like remote bookmarks (jj rebase -d master@) received only fragments of the word and returned nothing. Revset ranges (main::) and args containing = (git push --named a=) were affected the same way.
Wrap the generated bash completion function so that it rejoins the split words before handing them to the completer, and rebases the returned candidates on the part of the word that bash will actually replace. This is the approach git-completion.bash takes for its own word break characters; unlike the alternative of editing COMP_WORDBREAKS (and disabling bash's @-hostname completion, which would re-add @ there), it has no effect on the rest of the shell session.
Fixes #7758
Checklist
If applicable:
CHANGELOG.mdI have updated the documentation (README.md,docs/,demos/)I have updated the config schema (cli/src/config-schema.json)how it works, how it's organized), including any code drafted by an LLM.
an eye towards deleting anything that is irrelevant, clarifying anything
that is confusing, and adding details that are relevant. This includes,
for example, commit descriptions, PR descriptions, and code comments.