diff options
author | Blaž Hrastnik | 2020-05-25 04:02:21 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2020-05-25 04:02:21 +0000 |
commit | 44ff4d3c1f5da05e57ce99ba9d67b80a334def83 (patch) | |
tree | 232b8eebab7f709eaf84b8649791a6c74448bfdb /helix-core/src/state.rs | |
parent | 240e5f4e3d27415b792776dd126d15302d53e83b (diff) |
Implement a new core based on CodeMirror.
Diffstat (limited to 'helix-core/src/state.rs')
-rw-r--r-- | helix-core/src/state.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/helix-core/src/state.rs b/helix-core/src/state.rs new file mode 100644 index 00000000..81b8e108 --- /dev/null +++ b/helix-core/src/state.rs @@ -0,0 +1,38 @@ +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 { + pub fn new(buffer: Buffer) -> Self { + Self { + buffer, + selection: Selection::single(0, 0), + } + } + + // TODO: buf/selection accessors + + // update/transact + // replaceSelection (transaction that replaces selection) + // changeByRange + // changes + // slice + // + // getters: + // tabSize + // indentUnit + // languageDataAt() + // + // config: + // indentation + // tabSize + // lineUnit + // syntax + // foldable + // changeFilter/transactionFilter +} |