From 44ff4d3c1f5da05e57ce99ba9d67b80a334def83 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Mon, 25 May 2020 13:02:21 +0900 Subject: Implement a new core based on CodeMirror. --- helix-core/src/state.rs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 helix-core/src/state.rs (limited to 'helix-core/src/state.rs') 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 +} -- cgit v1.2.3-70-g09d2