aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorWojciech Kępka2021-06-18 06:19:34 +0000
committerGitHub2021-06-18 06:19:34 +0000
commit41b07486ad935ad820dd4ba210457a03c95e1145 (patch)
treef7c8bb69d3398d222e26a627d8b70627b73237f8 /helix-term/src/commands.rs
parent42142cf680197a2076b9fa8ec864b91e67068082 (diff)
Fix expansion of `~` (#284)
* Fix expansion of `~`, dont use directory relative to cwd. * Add `expand_tilde` * Bring back `canonicalize_path`, use `expand_tilde` to `normalize` * Make `:open ~` completion work * Fix clippy * Fold home dir into tilde in Document `realitve_path`
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index dc4805a5..b2dd0d11 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1188,8 +1188,8 @@ mod cmd {
.filter(|doc| doc.is_modified())
.map(|doc| {
doc.relative_path()
- .and_then(|path| path.to_str())
- .unwrap_or("[scratch]")
+ .map(|path| path.to_string_lossy().to_string())
+ .unwrap_or_else(|| "[scratch]".into())
})
.collect();
if !modified.is_empty() {
@@ -1487,7 +1487,7 @@ fn buffer_picker(cx: &mut Context) {
cx.editor
.documents
.iter()
- .map(|(id, doc)| (id, doc.relative_path().map(Path::to_path_buf)))
+ .map(|(id, doc)| (id, doc.relative_path()))
.collect(),
move |(id, path): &(DocumentId, Option<PathBuf>)| {
// format_fn