-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(zsh): handle backtick trigger edge case #4090
Conversation
I'd advocate for Alternative B as I've used the backtick as my trigger for 6+ years. The key is right next to the on an American layout and quite convenient. Thank you! |
It's just important that the cursor is in the 'command' part before the trigger; the actual position is not important.
For the current version, the The approach would still extract the correct command. More testing of these changes is needed. |
7943054
to
4024a29
Compare
An error occured when the trigger was assigned to '('
That was also my intention, but temporarily moving the cursor before calling the ls ; kill -9 `[TAB] Please test the latest patch. The zsh version affects many users, and it's source <(curl -fsSL https://raw.githubusercontent.com/LangLangBart/fzf/refs/heads/zsh_backtick/shell/completion.zsh) |
The patch works for me and my backtick trigger! Thank you! |
Thanks for testing. I will add man zshoptions | less --pattern 'WARN_CREATE_GLOBAL' WARN_CREATE_GLOBAL
Print a warning message when a global parameter is created in a
function by an assignment or in math context. This often indi-
cates that a parameter has not been declared local when it
should have been. Parameters explicitly declared global from
within a function using typeset -g do not cause a warning. Note
that there is no warning when a local parameter is assigned to
in a nested function, which may also indicate an error. # see 'zshbuiltins' for 'typeset'
man zshbuiltins |
c5c8b0a
to
845595c
Compare
Thanks, it all looks good to me, is there anything else you want to address? |
I am finished. During testing, I found no other issues. I hope The bugs (missing enhancement) reported from my |
No problem at all, I really appreciate your help. |
Merged thanks! |
Thank you @LangLangBart ! Really appreciate the fast turn around and response to my report. |
Description
FZF_COMPLETION_TRIGGER
#4088If a single backtick is used as a trigger, the
words
array fails to populatewith the command elements.
The idea here is to temporarily alter the
LBUFFER
before calling__fzf_extract_command
by escaping the backtick.The idea is to move the
CURSOR
before the trigger.This approach seems a bit hacky, which is why this PR is marked as a draft.
Alternative A
Create a list of invalid triggers, since other characters have also been found
to cause the same issue:
Testing covered only ASCII values 32-126; others were excluded for simplicity.
&
;
[
`
|
If the user attempts to use one, display a message using
zle -M [string]
toindicate the error. This places the string below the command line, prompting the
user to choose a different trigger character.
Alternative B
Fall back to the old extraction method if the words array is empty and the
LBUFFER
is not empty, with the downside that it would only work for the firstcommand.
Alternative B might be the best option. If a user encounters an issue like the
one described in #1992, simply suggest using a different trigger?