PowerShell / PSReadLine

A bash inspired readline implementation for PowerShell
BSD 2-Clause "Simplified" License
3.74k stars 295 forks source link

Partial completion should be quoted when at least one possible completion contains spaces #72

Open jhclark opened 10 years ago

jhclark commented 10 years ago

In Emacs mode.

(1) type cd C:\Program<tab>, you will get a list of completions as follows:

PS:50> cd C:\Program
Program Files        Program Files (x86)  ProgramData

(2) type <space>f, then <tab>

Also, please don't hate me for flooding the issue tracker. :)

lzybkr commented 10 years ago

No hating - if nobody reported issues, then it was trivially easy or nobody is using it.

I'm not perfectly happy with the current state, but I have played with this some. Currently if all completions are quoted, you'll get the quote. There's this annoying ProgramData directory that doesn't needs quotes, otherwise you'd see a quote.

Maybe I need a better heuristic, like if more completions have quotes than not, add the quote. I vaguely recall examples where always adding the quote would have been annoying.

jhclark commented 10 years ago

Hm, I'm still leaning toward the "add quotes for the sake of the one file/directory with spaces" heuristic.

I'm having a hard time thinking up any examples where adding the quote would be annoying, since auto-complete seems to behave pretty reasonably inside quotes. Also, I think the powershell parser will typically strip them before passing the string to a subprocess or commandlet. (*Based on my limited knowledge of the interpreter). A specific example might help.

daxian-dbw commented 4 years ago

Updated the PR description to make the ask clear.