Add Editor::insert_text

This commit is contained in:
Audrey Dutcher 2022-12-29 10:20:11 -08:00 committed by Jeremy Soller
parent c5a5913981
commit 39d3219df9
2 changed files with 30 additions and 19 deletions

View file

@ -1,7 +1,7 @@
#[cfg(not(feature = "std"))]
use alloc::string::String;
use crate::{Buffer, Cursor};
use crate::{AttrsList, Buffer, Cursor};
#[cfg(feature = "swash")]
use crate::Color;
@ -86,6 +86,10 @@ pub trait Edit<'a> {
// Also used by backspace, delete, insert, and enter when there is a selection
fn delete_selection(&mut self) -> bool;
/// Insert a string at the current cursor or replacing the current selection with the given
/// attributes, or with the previous character's attributes if None is given.
fn insert_string(&mut self, data: &str, attrs_list: Option<AttrsList>);
/// Perform an [Action] on the editor
fn action(&mut self, action: Action);