summaryrefslogtreecommitdiff
path: root/helix-core/src/state.rs
blob: 22de6ca7f1d172fe16decf1a52ae9ca3ef40a365 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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 {
    #[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
}