Skip to content

Conversation

@Aloxaf
Copy link
Owner

@Aloxaf Aloxaf commented Mar 10, 2020

Fix #56

Aloxaf added 4 commits March 10, 2020 13:11
`-U` flag causes bug when compleing parameter. But remove it will
let _approximate won't work.
@Aloxaf
Copy link
Owner Author

Aloxaf commented Mar 10, 2020

I don't know why the result of _approximate can't be inserted. This may take a long time, I will merge some useful changes to master.

Aloxaf added a commit that referenced this pull request Mar 10, 2020
You can now use _approximate, but there is no fzf support.
And a better stability.
@intelfx
Copy link

intelfx commented May 19, 2024

I just tried to merge this on top of master. After resolving two obvious conflicts, this almost works, except tht if the _approximate completer is invoked, the captured prefix inserted into fzf contains a spurious (#a<N>) prefix (apologies for screenshot, not sure how to capture fzf UI reasonably):

image

I guess this is related to the games _approximate plays with compadd itself:

                if (( ! $+functions[compadd] ))
                then
                        dounfunction=1
                        compadd () {
                                local ppre="$argv[(I)-p]"
                                [[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 && "${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return
                                if [[ "$PREFIX" = \~* && ( ppre -eq 0 || "$argv[ppre+1]" != \~* ) ]]
                                then
                                        PREFIX="~(#a${_comp_correct})${PREFIX[2,-1]}"
                                else
                                        PREFIX="(#a${_comp_correct})$PREFIX"
                                fi
                                (( $_correct_group && ${${argv[1,(r)-(|-)]}[(I)-*[JV]]} )) && _correct_expl[_correct_group]=${argv[1,(r)-(-|)][(R)-*[JV]]}
                                builtin compadd "$_correct_expl[@]" "$@"
                        }
                fi

Any ideas or pointers to start chasing?

@intelfx
Copy link

intelfx commented May 19, 2024

I added a dirtiest hack in intelfx@7f1d458 and _approximate seems to work reasonably with fzf-tab now. The only thing left is to maybe preselect the [corrections] group if it exists — @Aloxaf, any ideas on what's happening here or how can I do that?

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.

Support _approximate completer

3 participants