Skip to content
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

Overriding NAVI_FZF_OVERRIDES_VAR --header doesn't work with spaces #752

Closed
bagohart opened this issue Jul 10, 2022 · 2 comments · Fixed by #765
Closed

Overriding NAVI_FZF_OVERRIDES_VAR --header doesn't work with spaces #752

bagohart opened this issue Jul 10, 2022 · 2 comments · Fixed by #765
Labels
bug Something isn't working

Comments

@bagohart
Copy link

bagohart commented Jul 10, 2022

Describe the bug
I'm trying to override the --header function of fzf for the variable selection so I can print help text about distinguishing selecting the query or the selection like so (in fish shell):

$ begin; set -lx NAVI_FZF_OVERRIDES_VAR '--header "Press Enter or Tab to choose selection or query."'; navi --print; end

I get 'unknown option: Enter' and choosing the variable is skipped. It seems to me that parsing the spaces fails? Maybe this is related to #695 ? I also tried it with various escaping (escaping the spaces, using different quotes " and ', escaping the quotes " and ') but couldn't get it to work. Setting it in the config.yaml failed, too.
fzf does support spaces in its header, so this works:

fzf --header "Press Enter"

To Reproduce
Steps to reproduce the behavior:

  1. Use fish shell.
  2. Use the example cheatsheet:
% git, code

# Change branch
git checkout <branch>

$ branch: git branch | awk '{print $NF}'

in a git repo with at least 2 branches.

  1. This works:
begin; set -lx NAVI_FZF_OVERRIDES_VAR '--header "Press_Enter_Or_Tab"'; navi --print; end

but this doesn't:

begin; set -lx NAVI_FZF_OVERRIDES_VAR '--header "Press Enter Or Tab"'; navi --print; end
  1. Selection of the variable is skipped, and the output is
unknown option: Enter
git checkout

Expected behavior
The variable selection should work, and the header should be correctly displayed as "Press Enter Or Tab".

Versions:

  • OS: kubuntu 22.04 LTS
  • fish, version 3.5.0
  • navi 2.20.1 (downloaded latest navi binary)
@bagohart bagohart added the bug Something isn't working label Jul 10, 2022
@welcome
Copy link

welcome bot commented Jul 10, 2022

Thanks for opening your first issue here! In case you're facing a bug, please update navi to the latest version first. Maybe the bug is already solved! :)

@denisidoro
Copy link
Owner

The problem is in

.split(' ')

Instead of splitting by spaces, navi should honor bash's conventions for "word" splitting.

It should be trivial to fix it by calling the shellwords library, which already is a dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants