Clean up API and small fixes
This commit is contained in:
parent
665cdb2881
commit
a80da338e4
13 changed files with 56 additions and 36 deletions
|
|
@ -10,8 +10,8 @@ use wasm_bindgen::prelude::*;
|
|||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub struct CursorPosition {
|
||||
pub id: usize,
|
||||
pub char_index: usize,
|
||||
pub(crate) id: usize,
|
||||
pub(crate) char_index: usize,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "wasm", wasm_bindgen)]
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@ impl TextWithCursors {
|
|||
pub fn cursors(&self) -> Vec<CursorPosition> { self.cursors.clone() }
|
||||
}
|
||||
|
||||
impl TextWithCursors {
|
||||
#[must_use]
|
||||
pub fn text_ref(&self) -> &str { &self.text }
|
||||
}
|
||||
|
||||
impl<'a> From<&'a str> for TextWithCursors {
|
||||
fn from(text: &'a str) -> Self {
|
||||
Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue