diff options
author | Blaž Hrastnik | 2021-03-16 06:30:29 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-03-16 06:41:42 +0000 |
commit | 143cfe13e05b17840a9f2c69417ed98bc3b8cb0e (patch) | |
tree | 45cdea8a84a51a1cbf53daf55e5d9415d840762b /helix-view | |
parent | 4f77d80e74b1406b8701f5569b3bec8da2e5ed03 (diff) |
minor: TODO comment cleanup
Diffstat (limited to 'helix-view')
-rw-r--r-- | helix-view/src/document.rs | 4 | ||||
-rw-r--r-- | helix-view/src/view.rs | 9 |
2 files changed, 4 insertions, 9 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 033a3593..82258bde 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -255,8 +255,6 @@ impl Document { return; } - // TODO: change -> change -> undo -> change -> change fails, probably old_state needs reset - let new_changeset = ChangeSet::new(self.text()); let changes = std::mem::replace(&mut self.changes, new_changeset); // Instead of doing this messy merge we could always commit, and based on transaction @@ -319,7 +317,7 @@ impl Document { // self.state.doc.slice // } - // TODO: transact(Fn) ? + // transact(Fn) ? // -- LSP methods diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs index 5b269a9a..b406b756 100644 --- a/helix-view/src/view.rs +++ b/helix-view/src/view.rs @@ -13,15 +13,12 @@ use tui::layout::Rect; pub const PADDING: usize = 5; -// TODO: view should be View { doc: Document(state, history,..) } -// since we can have multiple views into the same file pub struct View { pub id: Key, pub doc: Document, pub first_line: usize, pub area: Rect, } -// TODO: popups should be a thing on the view with a rect + text impl View { pub fn new(doc: Document) -> Result<Self, Error> { @@ -54,9 +51,9 @@ impl View { /// Calculates the last visible line on screen #[inline] pub fn last_line(&self) -> usize { - let viewport = Rect::new(6, 0, self.area.width, self.area.height.saturating_sub(1)); // - 1 for statusline + let height = self.area.height.saturating_sub(1); // - 1 for statusline std::cmp::min( - self.first_line + (viewport.height as usize), + self.first_line + height as usize, self.doc.text().len_lines() - 1, ) } @@ -67,7 +64,7 @@ impl View { pub fn screen_coords_at_pos(&self, text: RopeSlice, pos: usize) -> Option<Position> { let line = text.char_to_line(pos); - if line < self.first_line as usize || line > self.last_line() { + if line < self.first_line || line > self.last_line() { // Line is not visible on screen return None; } |