diff --git a/Cargo.lock b/Cargo.lock index 46910df63..1100312c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -296,7 +296,6 @@ dependencies = [ "rsconf", "rust-embed", "serial_test", - "unicode-width", "unix_path", "xterm-color", ] diff --git a/Cargo.toml b/Cargo.toml index 14cc50478..740cb2051 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -126,7 +126,6 @@ num-traits.workspace = true once_cell.workspace = true pcre2.workspace = true rand.workspace = true -unicode-width.workspace = true xterm-color.workspace = true [target.'cfg(not(target_has_atomic = "64"))'.dependencies] diff --git a/src/pager.rs b/src/pager.rs index ce41ee985..ba4c4574d 100644 --- a/src/pager.rs +++ b/src/pager.rs @@ -15,7 +15,7 @@ use crate::screen::{CharOffset, Line, ScreenData, wcswidth_rendered, wcwidth_rendered}; use crate::termsize::Termsize; use fish_wcstringutil::string_fuzzy_match_string; -use unicode_width::UnicodeWidthStr as _; +use fish_widestring::decoded_width; /// Represents rendering from the pager. #[derive(Default)] @@ -1044,13 +1044,11 @@ pub fn set_fully_disclosed(&mut self) { // Position of the cursor. pub fn cursor_position(&self) -> usize { - let mut result = sprintf!( + let mut result = decoded_width(&sprintf!( "%s %s", wgettext!(SEARCH_FIELD_PROMPT), self.search_field_line.text() - ) - .to_string() - .width(); + )); // Clamp it to the right edge. if self.available_term_width > 0 && result + 1 > self.available_term_width { result = self.available_term_width - 1;