2021-06-18 00:09:10 +02:00
|
|
|
#[macro_use]
|
|
|
|
extern crate helix_view;
|
|
|
|
|
2021-06-07 06:40:21 +02:00
|
|
|
pub mod application;
|
|
|
|
pub mod args;
|
|
|
|
pub mod commands;
|
|
|
|
pub mod compositor;
|
2021-06-17 13:08:05 +02:00
|
|
|
pub mod config;
|
2022-03-08 06:25:46 +01:00
|
|
|
pub mod health;
|
2021-06-28 14:48:38 +02:00
|
|
|
pub mod job;
|
2021-06-07 06:40:21 +02:00
|
|
|
pub mod keymap;
|
|
|
|
pub mod ui;
|
2023-02-02 18:14:02 +01:00
|
|
|
use std::path::Path;
|
|
|
|
|
|
|
|
use ignore::DirEntry;
|
2022-03-25 10:05:20 +01:00
|
|
|
pub use keymap::macros::*;
|
2021-11-14 13:26:48 +01:00
|
|
|
|
2021-12-03 04:41:13 +01:00
|
|
|
#[cfg(not(windows))]
|
2021-11-14 13:26:48 +01:00
|
|
|
fn true_color() -> bool {
|
|
|
|
std::env::var("COLORTERM")
|
|
|
|
.map(|v| matches!(v.as_str(), "truecolor" | "24bit"))
|
|
|
|
.unwrap_or(false)
|
|
|
|
}
|
2021-12-03 04:41:13 +01:00
|
|
|
#[cfg(windows)]
|
|
|
|
fn true_color() -> bool {
|
|
|
|
true
|
|
|
|
}
|
2023-02-02 18:14:02 +01:00
|
|
|
|
|
|
|
/// 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 the .git directory, otherwise if
|
|
|
|
// `ignore` is turned off, we end up with a lot of noise
|
|
|
|
// in our picker.
|
|
|
|
if entry.file_name() == ".git" {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// We also ignore symlinks that point inside the current directory
|
|
|
|
// if `dedup_links` is enabled.
|
|
|
|
if dedup_symlinks && entry.path_is_symlink() {
|
|
|
|
return entry
|
|
|
|
.path()
|
|
|
|
.canonicalize()
|
|
|
|
.ok()
|
|
|
|
.map_or(false, |path| !path.starts_with(&root));
|
|
|
|
}
|
|
|
|
|
|
|
|
true
|
|
|
|
}
|