Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/lib.rs')
-rw-r--r--helix-term/src/lib.rs39
1 files changed, 13 insertions, 26 deletions
diff --git a/helix-term/src/lib.rs b/helix-term/src/lib.rs
index 75b67479..b1413ed0 100644
--- a/helix-term/src/lib.rs
+++ b/helix-term/src/lib.rs
@@ -20,39 +20,25 @@ mod handlers;
use ignore::DirEntry;
use url::Url;
-#[cfg(windows)]
-fn true_color() -> bool {
- true
-}
+pub use keymap::macros::*;
#[cfg(not(windows))]
fn true_color() -> bool {
- if matches!(
- std::env::var("COLORTERM").map(|v| matches!(v.as_str(), "truecolor" | "24bit")),
- Ok(true)
- ) {
- return true;
- }
-
- match termini::TermInfo::from_env() {
- Ok(t) => {
- t.extended_cap("RGB").is_some()
- || t.extended_cap("Tc").is_some()
- || (t.extended_cap("setrgbf").is_some() && t.extended_cap("setrgbb").is_some())
- }
- Err(_) => false,
- }
+ std::env::var("COLORTERM")
+ .map(|v| matches!(v.as_str(), "truecolor" | "24bit"))
+ .unwrap_or(false)
+}
+#[cfg(windows)]
+fn true_color() -> bool {
+ true
}
/// Function used for filtering dir entries in the various file pickers.
fn filter_picker_entry(entry: &DirEntry, root: &Path, dedup_symlinks: bool) -> bool {
- // We always want to ignore popular VCS directories, otherwise if
+ // We always want to ignore the .git directory, otherwise if
// `ignore` is turned off, we end up with a lot of noise
// in our picker.
- if matches!(
- entry.file_name().to_str(),
- Some(".git" | ".pijul" | ".jj" | ".hg" | ".svn")
- ) {
+ if entry.file_name() == ".git" {
return false;
}
@@ -63,7 +49,7 @@ fn filter_picker_entry(entry: &DirEntry, root: &Path, dedup_symlinks: bool) -> b
.path()
.canonicalize()
.ok()
- .is_some_and(|path| !path.starts_with(root));
+ .map_or(false, |path| !path.starts_with(root));
}
true
@@ -76,7 +62,8 @@ fn open_external_url_callback(
let commands = open::commands(url.as_str());
async {
for cmd in commands {
- let mut command: tokio::process::Command = cmd.into();
+ let mut command = tokio::process::Command::new(cmd.get_program());
+ command.args(cmd.get_args());
if command.output().await.is_ok() {
return Ok(job::Callback::Editor(Box::new(|_| {})));
}