From fc7b01b8c2b62deb401d4f0dcaef095848f140c1 Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 13 Jun 2022 23:14:57 +0200 Subject: [PATCH] Round cursor position towards top of screen --- cove-tui/src/chat/tree.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cove-tui/src/chat/tree.rs b/cove-tui/src/chat/tree.rs index f9e3e46..f2bbd86 100644 --- a/cove-tui/src/chat/tree.rs +++ b/cove-tui/src/chat/tree.rs @@ -118,7 +118,7 @@ impl Layout { fn calculate_offsets_with_cursor(&mut self, cursor: &Cursor, height: i32) { let cursor_index = self.mark_cursor(&cursor.id); - let cursor_line = ((height - 1) as f32 * cursor.proportion).round() as i32; + let cursor_line = ((height - 1) as f32 * cursor.proportion).floor() as i32; // Propagate lines from cursor to both ends self.blocks[cursor_index].line = cursor_line;