Clean up API and small fixes

This commit is contained in:
Andras Schmelczer 2026-03-10 21:35:09 +00:00
parent 665cdb2881
commit a80da338e4
13 changed files with 56 additions and 36 deletions

View file

@ -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)]

View file

@ -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 {