aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorMichael Davis2024-01-16 18:59:48 +0000
committerBlaž Hrastnik2024-01-18 01:57:53 +0000
commit1f916e65cff4459698d465b2f4558da1e1bf6e44 (patch)
tree5b6768e3069085bc5ba995efa95fdc73241ed0f6 /helix-term/src/ui
parentaf8e524a7d06253fa854bf8954f64312e11d0ea0 (diff)
Create helix-stdx crate for stdlib extensions
helix-stdx is meant to carry extensions to the stdlib or low-level dependencies that are useful in all other crates. This commit starts with all of the path functions from helix-core and the CWD tracking that lived in helix-loader. The CWD tracking in helix-loader was previously unable to call the canonicalization functions in helix-core. Switching to our custom canonicalization code should make no noticeable difference though since `std::env::current_dir` returns a canonicalized path with symlinks resolved (at least on unix).
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/mod.rs4
-rw-r--r--helix-term/src/ui/picker.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs
index 660bbfea..efa2473e 100644
--- a/helix-term/src/ui/mod.rs
+++ b/helix-term/src/ui/mod.rs
@@ -409,7 +409,7 @@ pub mod completers {
use std::path::Path;
let is_tilde = input == "~";
- let path = helix_core::path::expand_tilde(Path::new(input));
+ let path = helix_stdx::path::expand_tilde(Path::new(input));
let (dir, file_name) = if input.ends_with(std::path::MAIN_SEPARATOR) {
(path, None)
@@ -430,7 +430,7 @@ pub mod completers {
match path.parent() {
Some(path) if !path.as_os_str().is_empty() => path.to_path_buf(),
// Path::new("h")'s parent is Some("")...
- _ => helix_loader::current_working_dir(),
+ _ => helix_stdx::env::current_working_dir(),
}
};
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 08a367ba..4be5a11e 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -63,7 +63,7 @@ impl PathOrId {
fn get_canonicalized(self) -> Self {
use PathOrId::*;
match self {
- Path(path) => Path(helix_core::path::get_canonicalized_path(&path)),
+ Path(path) => Path(helix_stdx::path::canonicalize(path)),
Id(id) => Id(id),
}
}