helix-mods/helix-core/src/state.rs

44 lines
898 B
Rust
Raw Normal View History

use crate::{Buffer, Selection};
/// A state represents the current editor state of a single buffer.
pub struct State {
// TODO: maybe doc: ?
buffer: Buffer,
selection: Selection,
}
impl State {
2020-05-28 07:45:44 +02:00
#[must_use]
pub fn new(buffer: Buffer) -> Self {
Self {
buffer,
selection: Selection::single(0, 0),
}
}
// TODO: buf/selection accessors
// 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
}