fix off-by-1 column widths; add edit cursor

This commit is contained in:
🪞👃🪞 2025-03-23 21:49:38 +02:00
parent 59918491f6
commit 4bfdd28638
7 changed files with 57 additions and 59 deletions

View file

@ -92,14 +92,14 @@ impl Taggart {
}
pub fn edit_insert (&mut self, c: char) {
if let Some((edit_index, value)) = &mut self.editing {
self.editing = Some((*edit_index, format!("{value}{c}")));
self.editing = Some((*edit_index + 1, format!("{value}{c}")));
}
}
pub fn edit_backspace (&mut self) {
if let Some((edit_index, value)) = &mut self.editing {
let mut chars = value.chars();
chars.next_back();
self.editing = Some((*edit_index, chars.as_str().into()));
self.editing = Some((edit_index.saturating_sub(1), chars.as_str().into()));
}
}
pub fn edit_delete (&mut self) {