mirror of
https://codeberg.org/unspeaker/perch.git
synced 2025-12-06 17:46:42 +01:00
fix off-by-1 column widths; add edit cursor
This commit is contained in:
parent
59918491f6
commit
4bfdd28638
7 changed files with 57 additions and 59 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue