From 69c20d4dd3df49b22d80b11d63b35e8a914475bb Mon Sep 17 00:00:00 2001 From: Zhang ShengYan Date: Sat, 24 Aug 2024 09:41:25 +0800 Subject: [PATCH] fix: wrong `debug_assert` in `OrderedFloat` for NaN (#1547) --- yazi-cli/src/main.rs | 2 ++ yazi-config/preset/yazi.toml | 4 ++-- yazi-shared/src/number.rs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/yazi-cli/src/main.rs b/yazi-cli/src/main.rs index add9013e..f5175412 100644 --- a/yazi-cli/src/main.rs +++ b/yazi-cli/src/main.rs @@ -6,6 +6,8 @@ use clap::Parser; #[tokio::main] async fn main() -> anyhow::Result<()> { + yazi_shared::init(); + if std::env::args_os().nth(1).is_some_and(|s| s == "-V" || s == "--version") { println!( "Ya {} ({} {})", diff --git a/yazi-config/preset/yazi.toml b/yazi-config/preset/yazi.toml index 06d75096..496f2177 100644 --- a/yazi-config/preset/yazi.toml +++ b/yazi-config/preset/yazi.toml @@ -182,13 +182,13 @@ delete_offset = [ 0, 0, 70, 20 ] overwrite_title = "Overwrite file?" overwrite_content = "Will overwrite the following file:" overwrite_origin = "center" -overwrite_offset = [ 0, 0, 50, 20 ] +overwrite_offset = [ 0, 0, 50, 15 ] # quit quit_title = "Quit?" quit_content = "The following task is still running, are you sure you want to quit?" quit_origin = "center" -quit_offset = [ 0, 0, 50, 20 ] +quit_offset = [ 0, 0, 50, 15 ] [select] open_title = "Open with:" diff --git a/yazi-shared/src/number.rs b/yazi-shared/src/number.rs index 0633a8c7..774af07c 100644 --- a/yazi-shared/src/number.rs +++ b/yazi-shared/src/number.rs @@ -9,7 +9,7 @@ pub struct OrderedFloat(f64); impl OrderedFloat { #[inline] pub fn new(t: f64) -> Self { - debug_assert!(t.is_nan()); + debug_assert!(!t.is_nan()); Self(t) }