diff options
Diffstat (limited to 'src/app/actions.rs')
| -rw-r--r-- | src/app/actions.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/app/actions.rs b/src/app/actions.rs index 68286952..3fedeeb3 100644 --- a/src/app/actions.rs +++ b/src/app/actions.rs @@ -11,7 +11,6 @@ use crate::layout::{find_in_direction, NavDirection}; use crate::selection::Selection; use crate::terminal::{EffectiveStateChange, TerminalStateMutation}; use crate::workspace::WorkspaceGitStatus; -use unicode_width::UnicodeWidthChar; use super::state::{ text_matches_query, AgentNotificationDelivery, AppState, Mode, NavigatorRow, @@ -2220,7 +2219,7 @@ pub(crate) fn visible_text_cells(text: &str, pane_width: u16) -> Vec<VisibleText pending_wrap = false; } - let width = UnicodeWidthChar::width(ch).unwrap_or(0) as u16; + let width = u16::from(crate::ghostty::unicode_codepoint_width(ch as u32)); cells.push(VisibleTextCell { byte_index, ch, @@ -2252,7 +2251,7 @@ pub(crate) fn logical_cell_for_visible_cell( visible_text_cells(text, pane_width) .into_iter() .find(|cell| { - let width = UnicodeWidthChar::width(cell.ch).unwrap_or(0) as u16; + let width = u16::from(crate::ghostty::unicode_codepoint_width(cell.ch as u32)); cell.screen_row == target_row && if width == 0 { target_col == cell.screen_col @@ -2285,7 +2284,7 @@ fn text_cells(row: &str) -> Vec<TextCell> { let mut next_col = 0u16; row.chars() .map(|ch| { - let width = UnicodeWidthChar::width(ch).unwrap_or(0) as u16; + let width = u16::from(crate::ghostty::unicode_codepoint_width(ch as u32)); let start_col = if width == 0 { next_col.saturating_sub(1) } else { @@ -3190,7 +3189,7 @@ mod tests { let prefix = &row[..byte_idx]; prefix .chars() - .map(|ch| UnicodeWidthChar::width(ch).unwrap_or(0) as u16) + .map(|ch| u16::from(crate::ghostty::unicode_codepoint_width(ch as u32))) .sum() } |
