Skip to content

Commit

Permalink
Buffer: fix max scroll going one line beyond end
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 committed Nov 30, 2023
1 parent 1cf36f8 commit afc5b52
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ impl Buffer {
let scroll_end = self.scroll + lines;
let total_layout = self.shape_until(font_system, scroll_end);

self.scroll = cmp::max(0, cmp::min(total_layout - (lines - 1), self.scroll));
self.scroll = cmp::max(0, cmp::min(total_layout - lines, self.scroll));
}

pub fn layout_cursor(&self, cursor: &Cursor) -> LayoutCursor {

Check warning on line 486 in src/buffer.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function which may panic missing `# Panics` section

warning: docs for function which may panic missing `# Panics` section --> src/buffer.rs:486:5 | 486 | pub fn layout_cursor(&self, cursor: &Cursor) -> LayoutCursor { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first possible panic found here --> src/buffer.rs:490:22 | 490 | let layout = line.layout_opt().as_ref().expect("layout not found"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
Expand Down

0 comments on commit afc5b52

Please sign in to comment.