Skip to content

completions: rejoin bash words split at COMP_WORDBREAKS - #10213

Open
nikosavola wants to merge 1 commit into
jj-vcs:mainfrom
nikosavola:nikosavola/push-uqtwmmxrmkws
Open

nikosavola wants to merge 1 commit into
jj-vcs:mainfrom
nikosavola:nikosavola/push-uqtwmmxrmkws

Conversation

@nikosavola

@nikosavola nikosavola commented Sep 17, 2026

Copy link
Copy Markdown
Member

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:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added/updated tests to cover my changes
  • I fully understand the code that I am submitting (what it does,
    how it works, how it's organized), including any code drafted by an LLM.
  • For any prose generated by an LLM, I have proof-read and copy-edited with
    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.

@nikosavola nikosavola self-assigned this Sep 17, 2026
@nikosavola
nikosavola requested a review from a team as a code owner September 17, 2026 13:07
@nikosavola
nikosavola force-pushed the nikosavola/push-uqtwmmxrmkws branch from f915be3 to 3581b12 Compare September 17, 2026 13:41
Comment thread CHANGELOG.md Outdated
@nikosavola
nikosavola force-pushed the nikosavola/push-uqtwmmxrmkws branch from 3581b12 to 8c2311f Compare September 17, 2026 15:52
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread cli/src/cli_util.rs Outdated
@nikosavola
nikosavola force-pushed the nikosavola/push-uqtwmmxrmkws branch from 8c2311f to 6058e13 Compare September 17, 2026 17:12
Comment thread cli/src/cli_util.rs
@nikosavola
nikosavola force-pushed the nikosavola/push-uqtwmmxrmkws branch from 6058e13 to 1b93feb Compare September 18, 2026 07:11
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamic completion on rebase destination does not work properly for remote bookmarks

2 participants