aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/view.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-02-13 09:31:51 +0000
committerBlaž Hrastnik2022-02-13 09:31:51 +0000
commitbd549d8a20cce98e24c8653a4a86107c786cbaa3 (patch)
tree0780b58d41b6181e69023265cdb54517e2953778 /helix-view/src/view.rs
parent7ad8eaaef0b292f4be6c66298cea40d2b928e172 (diff)
parent7083b98a388b30e0b61caac9bf6ccc1d79eadf81 (diff)
Merge remote-tracking branch 'origin/master' into debug
Diffstat (limited to 'helix-view/src/view.rs')
-rw-r--r--helix-view/src/view.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs
index 9336742b..6bc9435c 100644
--- a/helix-view/src/view.rs
+++ b/helix-view/src/view.rs
@@ -78,6 +78,13 @@ pub struct View {
pub jumps: JumpList,
/// the last accessed file before the current one
pub last_accessed_doc: Option<DocumentId>,
+ /// the last modified files before the current one
+ /// ordered from most frequent to least frequent
+ // uses two docs because we want to be able to swap between the
+ // two last modified docs which we need to manually keep track of
+ pub last_modified_docs: [Option<DocumentId>; 2],
+ /// used to store previous selections of tree-sitter objecs
+ pub object_selections: Vec<Selection>,
}
impl View {
@@ -89,6 +96,8 @@ impl View {
area: Rect::default(), // will get calculated upon inserting into tree
jumps: JumpList::new((doc, Selection::point(0))), // TODO: use actual sel
last_accessed_doc: None,
+ last_modified_docs: [None, None],
+ object_selections: Vec::new(),
}
}
@@ -370,7 +379,7 @@ mod tests {
let text = rope.slice(..);
assert_eq!(
- view.text_pos_at_screen_coords(&text, 40, 40 + OFFSET + 0, 4),
+ view.text_pos_at_screen_coords(&text, 40, 40 + OFFSET, 4),
Some(0)
);
@@ -403,7 +412,7 @@ mod tests {
let text = rope.slice(..);
assert_eq!(
- view.text_pos_at_screen_coords(&text, 40, 40 + OFFSET + 0, 4),
+ view.text_pos_at_screen_coords(&text, 40, 40 + OFFSET, 4),
Some(0)
);