Fix cursor scrolling

When scrolling up, the cursor would get stuck at certain screen heights,
i.e. the screen would scroll and the cursor would stay at the same line.
When scrolling down, the screen would sometimes jump by one line.

This weird behaviour was caused by an incorrect conversion between
screen lines and cursor proportion.
This commit is contained in:
Joscha 2022-06-24 00:56:36 +02:00
parent bdf651b40c
commit 54b056ba1c

View file

@ -44,7 +44,7 @@ pub fn after_nick(frame: &mut Frame, indent: usize, nick: &str) -> i32 {
}
pub fn proportion_to_line(height: u16, proportion: f32) -> i32 {
((height - 1) as f32 * proportion).ceil() as i32
((height - 1) as f32 * proportion).round() as i32
}
pub fn line_to_proportion(height: u16, line: i32) -> f32 {