aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/document.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/document.rs')
-rw-r--r--helix-view/src/document.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index 22438926..a313b281 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -108,6 +108,11 @@ impl Document {
};
}
+ pub fn set_selection(&mut self, selection: Selection) {
+ // TODO: use a transaction?
+ self.state.selection = selection;
+ }
+
pub fn apply(&mut self, transaction: &Transaction) -> bool {
let old_doc = self.text().clone();
@@ -119,6 +124,8 @@ impl Document {
changes.compose(transaction.changes().clone()).unwrap()
});
+ // TODO: when composing, replace transaction.selection too
+
// update tree-sitter syntax tree
if let Some(syntax) = &mut self.syntax {
// TODO: no unwrap
@@ -150,6 +157,10 @@ impl Document {
&self.state.doc
}
+ pub fn selection(&self) -> &Selection {
+ &self.state.selection
+ }
+
// pub fn slice<R>(&self, range: R) -> RopeSlice where R: RangeBounds {
// self.state.doc.slice
// }