2023-08-20 00:46:55 +02:00
|
|
|
//! ### buffer
|
|
|
|
//!
|
|
|
|
//! a buffer is a container fo text edited by users.
|
|
|
|
//! this module contains buffer-related operations and helpers to create Operation Sequences
|
|
|
|
//! (the underlying chunks of changes sent over the wire)
|
|
|
|
|
2023-08-16 23:09:47 +02:00
|
|
|
use std::ops::Range;
|
|
|
|
|
|
|
|
pub(crate) mod worker;
|
2023-08-20 00:46:55 +02:00
|
|
|
|
|
|
|
/// buffer controller implementation
|
2023-07-30 17:48:55 +02:00
|
|
|
pub mod controller;
|
2023-08-20 00:46:55 +02:00
|
|
|
|
|
|
|
/// operation factory, with helper functions to produce opseqs
|
2023-08-16 23:09:47 +02:00
|
|
|
pub mod factory;
|
|
|
|
|
2023-08-19 21:44:27 +02:00
|
|
|
pub use factory::OperationFactory;
|
|
|
|
pub use controller::BufferController as Controller;
|
2023-08-16 23:09:47 +02:00
|
|
|
|
2023-08-19 21:44:27 +02:00
|
|
|
|
2023-08-20 00:46:55 +02:00
|
|
|
/// an editor-friendly representation of a text change in a buffer
|
|
|
|
///
|
2023-08-19 21:44:27 +02:00
|
|
|
/// TODO move in proto
|
2023-08-19 04:02:21 +02:00
|
|
|
#[derive(Debug)]
|
2023-08-16 23:09:47 +02:00
|
|
|
pub struct TextChange {
|
2023-08-20 00:46:55 +02:00
|
|
|
/// range of text change, as byte indexes in buffer
|
2023-08-16 23:09:47 +02:00
|
|
|
pub span: Range<usize>,
|
2023-08-20 00:46:55 +02:00
|
|
|
/// content of text change, as string
|
2023-08-16 23:09:47 +02:00
|
|
|
pub content: String,
|
|
|
|
}
|