-
-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[builtin] Fix compadjust
crashes with empty and sparse COMP_ARGV
#2213
Conversation
compadjust
crashes with empty and sparse COMP_ARGV
compadjust
crashes with empty and sparse COMP_ARGV
if a is not None: | ||
completion.AdjustArg(a, break_chars, adjusted_argv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I currently skip the unset elements, but an alternative behavior is to treat it as an empty string so that the indices of the words in COMP_ARGV
would be preserved in the resulting cur
, prev
, cword
, and words
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, to be honest I am not sure what is better
I'm not sure anyone uses "compadjust", but the reason I added it because I noticed the same hack being copied between the bash-completion
and the git-completion.bash
maintained by git
So I put it in the OSH interpreter instead
However now I feel kind of like this person
https://news.ycombinator.com/item?id=42536846
For context, I was the maintainer of FreeBSD's "bash-completion" port for a few years way back when
After working with the bash-completion codebase, I think it's kind of a dead end, even though it's the default on Debian ...
I actually want OSH to be able to run fish completions !!! From what I see, I think that is A LOT easier than running bash completions ! Curious if you have any thoughts on that, since as I understand ble.sh gives a fish-like experience
(Personally I prefer to hit tab, I don't like the "autosuggest" like fish has. But it seems like people like the completion logic)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also thought about ble.sh
's integration with the Fish completion settings, the Zsh completion settings, and others such as Carapace. An issue with the Fish completion settings is that it sometimes calls a shell function, written in the Fish syntax. One needs to re-implement those Fish functions in Bash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at the fish completion corpus, and I think the vast majority don't involve any fish functions
So there could be some kind of "best effort" conversion, where we just ignore the functions to start
It would be a way to "kick off" an OSH completion corpus.
The obvious candidate for that was the bash-completion project, since OSH is compatible with bash, but that codebase has a ton of obvious bugs IME. I think the fish completion is less ambitious, and therefore more likely to be correct
Thank you for fixing this! |
Thank you! |
There are two crashes with
compadjust
.With the current
master
branch,Commit e0df355 fixes this.
Even having that fixed, there is another crash:
Commit b6f85b5 fixes it.