mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 13:06:08 +02:00
support forward slash for directory completion in Windows (#3201)
While the "main" separator in Windows is the backslash, it supports the forward slash as a separator too. Add support for this so that the behavior is similar to the way Windows PowerShell handles the forward slash: it is recognized as a separator, and when using <tab> for path completion the slash is reversed.
This commit is contained in:
committed by
GitHub
parent
a5cdd22bfe
commit
840bd98e01
@ -143,7 +143,7 @@ async fn maybe_autocd_dir<'a>(
|
||||
// - the command name ends in a path separator, or
|
||||
// - it's not a command on the path and no arguments were given.
|
||||
let name = &cmd.name;
|
||||
let path_name = if name.ends_with(std::path::MAIN_SEPARATOR)
|
||||
let path_name = if name.ends_with(std::path::is_separator)
|
||||
|| (cmd.args.is_empty()
|
||||
&& PathBuf::from(name).is_dir()
|
||||
&& dunce::canonicalize(name).is_ok()
|
||||
|
Reference in New Issue
Block a user