Add move_to method to Editor

This commit is contained in:
Héctor Ramón Jiménez 2025-12-01 20:11:42 +01:00
parent 63e9eeffb5
commit 4428f31b4f
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
4 changed files with 295 additions and 258 deletions

View file

@ -190,6 +190,8 @@ impl text::Editor for () {
fn perform(&mut self, _action: text::editor::Action) {}
fn move_to(&mut self, _cursor: text::editor::Cursor) {}
fn bounds(&self) -> Size {
Size::ZERO
}

View file

@ -35,6 +35,9 @@ pub trait Editor: Sized + Default {
/// Performs an [`Action`] on the [`Editor`].
fn perform(&mut self, action: Action);
/// Moves the cursor to the given position.
fn move_to(&mut self, cursor: Cursor);
/// Returns the current boundaries of the [`Editor`].
fn bounds(&self) -> Size;