linuxmint / nemo

File browser for Cinnamon
GNU General Public License v2.0
1.22k stars 300 forks source link

Nemo not escaping blank spaces in filename when opening files with Neovim #2720

Open Niklas81 opened 3 years ago

Niklas81 commented 3 years ago

When opening any textfile with Neovim from Nemo, the file is opened as if the filename was provided without escaping the blank spaces. For example, if I open the existing file ~/test testfile, Neovim opens two new, empty files, named test and testfile, in the same manner as it would had I executed nvim ~/test testfile in a terminal emulator. The expected behavior is Nemo to open the file as if I instead would have executed nvim "~/test testfile" or nvim ~/test\ testfile. When opening with another text-editor, the expected behavior is observed.

 * Nemo version: 4.8.3
 * Nemo file manager
 * OS: FreeBSD 13 BETA 3
 * Thinkpad P50 NVIDIA Graphics
 * 64 bit
Jeremy7701 commented 3 years ago

Does this happen with other editors?

Actually, this seems to happen with CLI programs (mainly), but not happen with GUI programs (mainly) - for example:-

Screenshot from 2021-04-04 14-47-59

I'd guess that it depends on the existence of a .desktop file.

Have you tried neovim-qt - "neovim-qt provides a Qt5 GUI interface for neovim"

Niklas81 commented 3 years ago

I prefer using a non-gui. neovim-qt kills my tabline, font scaling etc..

Q: Does this happen with other editors? A: When opening with another text-editor, the expected behavior is observed. So no. But I've only tried using featherpad. I do have a .desktop-file for neovim, but not quite sure if it's used. When I edit it and change terminal, it still opens in the same. Perhaps it requires a reboot. Don't have a desktop file for vi, ee or other terminal-based editors.

Still, it seems to me this is an issue with Nemo. If I execute nvim "~/test testfile" or nvim ~/test\ testfile from a terminal, it opens it correctly.

christoph-petzold commented 3 years ago

Hi @Niklas81,

this seems to be related to this one #2739. The %F Token is used in Actions. There i have the same Problem with white spaces in file and directory names.

Niklas81 commented 3 years ago

Thanks for notifying me!

WhyNotHugo commented 3 years ago

%f fails too.

The issue seems related to the Terminal=true attribute. I edited the desktop entry for my image viewer. With the original Terminal=false, it works fine, with Terminal=true, it fails.

[Desktop Entry]
Type=Application
Version=1.0
Name=iii
Exec=imv %f
Icon=multimedia-photo-viewer
Terminal=true
Categories=Graphics;2DGraphics;Viewer;
MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap;
Keywords=photo;picture;

Fiddling with some test scripts, it seems that if Terminal=true, spaces are not escaped properly when passed to the subprocess.