chore: refactor the input component (#165)

* refactor the input component

* fix clippy

* clean up
This commit is contained in:
reya
2025-09-25 08:03:14 +07:00
committed by GitHub
parent a87184214f
commit 61cad5dd96
20 changed files with 2529 additions and 1593 deletions

View File

@@ -1,28 +1,28 @@
use std::fmt::Debug;
use std::ops::Range;
use crate::history::HistoryItem;
use crate::input::cursor::Selection;
#[derive(Debug, PartialEq, Clone)]
pub struct Change {
pub(crate) old_range: Range<usize>,
pub(crate) old_range: Selection,
pub(crate) old_text: String,
pub(crate) new_range: Range<usize>,
pub(crate) new_range: Selection,
pub(crate) new_text: String,
version: usize,
}
impl Change {
pub fn new(
old_range: Range<usize>,
old_range: impl Into<Selection>,
old_text: &str,
new_range: Range<usize>,
new_range: impl Into<Selection>,
new_text: &str,
) -> Self {
Self {
old_range,
old_range: old_range.into(),
old_text: old_text.to_string(),
new_range,
new_range: new_range.into(),
new_text: new_text.to_string(),
version: 0,
}