mirror of https://github.com/helix-editor/helix
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
840 B
Rust
42 lines
840 B
Rust
use crate::{Rope, Selection};
|
|
|
|
/// A state represents the current editor state of a single buffer.
|
|
#[derive(Clone)]
|
|
pub struct State {
|
|
pub doc: Rope,
|
|
pub selection: Selection,
|
|
}
|
|
|
|
impl State {
|
|
#[must_use]
|
|
pub fn new(doc: Rope) -> Self {
|
|
Self {
|
|
doc,
|
|
selection: Selection::point(0),
|
|
}
|
|
}
|
|
|
|
// update/transact:
|
|
// update(desc) => transaction ? transaction.doc() for applied doc
|
|
// transaction.apply(doc)
|
|
// doc.transact(fn -> ... end)
|
|
|
|
// replaceSelection (transaction that replaces selection)
|
|
// changeByRange
|
|
// changes
|
|
// slice
|
|
//
|
|
// getters:
|
|
// tabSize
|
|
// indentUnit
|
|
// languageDataAt()
|
|
//
|
|
// config:
|
|
// indentation
|
|
// tabSize
|
|
// lineUnit
|
|
// syntax
|
|
// foldable
|
|
// changeFilter/transactionFilter
|
|
}
|