srid / neuron

Future-proof note-taking and publishing based on Zettelkasten (superseded by Emanote: https://github.com/srid/emanote)
https://neuron.zettel.page
GNU Affero General Public License v3.0
1.52k stars 150 forks source link

`neuron search -e` can't open files with blanks in filename #435

Closed LATBauerdick closed 4 years ago

LATBauerdick commented 4 years ago

at least not if $EDITOR is set to nvim. It looks like that the file name returned from fzf needs to escape the blank characters.

e.g. if the search result returns the file name one two.md, the editor opens two files, with the filenames of one and two.md.

LATBauerdick commented 4 years ago

There seem to be more general problems with "special characters" in ID and filenames.

Try a filename/title/ID like "R&D Goals"!

for the problem with neuron search -e the effect is similar to the difference of, e.g. nvim $(fzf) vs nvim "$(fzf)"

the first can't deal with "special" file names, the latter seems to work fine -- although I'm not sure it will deal with all possible cases.

srid commented 4 years ago

I think this is because we are piping the filename output unquoted to the editor: https://github.com/srid/neuron/blob/a33ccad0b84bef9dc1c06ccd913f0e5d4724881c/neuron/src/app/Neuron/CLI/Search.hs#L36-L37

Changing the above to use xargs as indicated here might be one fix.

srid commented 4 years ago

This is working in current master (probably due to #445?), so I'll close.