diff --git a/Cargo.lock b/Cargo.lock index 7df21c5..65cc025 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -680,7 +680,6 @@ dependencies = [ "indoc", "itertools", "ratatui", - "unicode-width", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a4102fe..d46f17b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,6 @@ edition = "2021" crossterm = "0.27.0" itertools = "0.12.1" ratatui = "0.26.2" -unicode-width = "0.1.12" [dev-dependencies] clap = { version = "4.5.4", features = ["derive"] } diff --git a/src/text_prompt.rs b/src/text_prompt.rs index 09f1a58..e6d0f69 100644 --- a/src/text_prompt.rs +++ b/src/text_prompt.rs @@ -7,7 +7,6 @@ use ratatui::{ prelude::*, widgets::{Block, Paragraph, StatefulWidget, Widget}, }; -use unicode_width::UnicodeWidthStr; // TODO style the widget // TODO style each element of the widget. @@ -101,7 +100,7 @@ impl<'a> StatefulWidget for TextPrompt<'a> { " › ".cyan().dim(), Span::raw(value), ]); - let prompt_length = line.to_string().width() - value_length; + let prompt_length = line.width() - value_length; let lines = wrap(line, width).take(height).collect_vec(); // constrain the position to the area