helix icon indicating copy to clipboard operation
helix copied to clipboard

cd command auto-completion with spaces in path

Open wiebecommajonas opened this issue 3 years ago • 1 comments

Summary

The :cd command seems to be tripped up by spaces in the path. The auto-completion stops working and the current behavior should be changed. Auto-completed directories should be pasted either with escaped spaces or with " surrounding the whole path. I do not know if this affects other commands.

Reproduction Steps

I tried this:

mkdir a\ b
hx .

Inside hx: :cd a<tab> works and shows directory a b. Selecting this pastes :cd a b into the command line.

I expected this to happen:

I expected the command to read :cd a\ b or :cd "a b" after selecting the auto-completion item.

Instead, this happened:

I got the error pasted in the log section below.

Additionally the auto completion stops working after I encounter a directory containing a space (even when I type it manually with \ for spaces).

Helix log

~/.cache/helix/helix.log
2022-11-07T15:58:24.206 helix_view::editor [ERROR] editor error: Couldn't change the current working directory: No such file or directory (os error 2)

Platform

macOS

Terminal Emulator

iTerm2

Helix Version

helix 22.08.1 (f41f28b6)

wiebecommajonas avatar Nov 07 '22 15:11 wiebecommajonas

Mostly a duplicate of https://github.com/helix-editor/helix/issues/4266. Also see https://github.com/helix-editor/helix/pull/4316, https://github.com/helix-editor/helix/pull/4587.

There's a remaining edge-case where :cd a\<tab> produces an incorrect result. I have some local changes that fix this that I'll push.

the-mikedavis avatar Nov 07 '22 15:11 the-mikedavis