From 76e61b1abb2b294d1d5a339a4804de02cde12512 Mon Sep 17 00:00:00 2001 From: alemi Date: Fri, 17 Nov 2023 05:53:38 +0100 Subject: [PATCH] docs: include doc into textchange block --- src/api/change.rs | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/api/change.rs b/src/api/change.rs index e911fae..95e34fa 100644 --- a/src/api/change.rs +++ b/src/api/change.rs @@ -1,20 +1,23 @@ //! # TextChange -//! this represent a range in the previous state of the string and a new content which should be -//! replaced to it, allowing to represent any combination of deletions, insertions or replacements -//! -//! bulk and widespread operations will result in a TextChange effectively sending the whole new -//! buffer, but small changes are efficient and easy to create or apply -//! -//! ### examples -//! to insert 'a' after 4th character we should send a -//! `TextChange { span: 4..4, content: "a".into() }` -//! -//! to delete a the fourth character we should send a -//! `TextChange { span: 3..4, content: "".into() }` //! +//! an editor-friendly representation of a text change in a buffer +//! to easily interface with codemp from various editors /// an editor-friendly representation of a text change in a buffer -/// span refers to previous text content +/// +/// this represent a range in the previous state of the string and a new content which should be +/// replaced to it, allowing to represent any combination of deletions, insertions or replacements +/// +/// bulk and widespread operations will result in a TextChange effectively sending the whole new +/// buffer, but small changes are efficient and easy to create or apply +/// +/// ### examples +/// to insert 'a' after 4th character we should send a +/// `TextChange { span: 4..4, content: "a".into() }` +/// +/// to delete a the fourth character we should send a +/// `TextChange { span: 3..4, content: "".into() }` +/// #[derive(Clone, Debug, Default)] pub struct TextChange { /// range of text change, as char indexes in buffer previous state