diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-03-27 11:36:40 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-03-27 11:36:40 -0700 |
| commit | a52b286d6c8e2000c416f23eece0b930fe8ec4e9 (patch) | |
| tree | c40b556fd6c63a9cad0df542c975779e84e4bc08 /src/main.rs | |
| parent | 46b955afbce8997c39bda4e83abcaed2e954e65c (diff) | |
scrolling now uses the terminal scroll feature when possible
it doesn't redraw the newly blank lines in that case though, so it's broken, but that can come next Force-Push: yes Change-Id: I52c90249852331e5f9bbcdee4d645ee33e4c671a
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 2f93a2e..b94b274 100644 --- a/src/main.rs +++ b/src/main.rs @@ -161,7 +161,8 @@ impl Ivy { terminal.stdout.write_all("\n~".as_bytes()).await?; } - terminal.stdout.write_all("\n status goes here".as_bytes()).await?; + terminal.do_cursor_position(0, height).await?; + terminal.stdout.write_all(" status goes here".as_bytes()).await?; let window = self.window.read().await; terminal.do_cursor_position(*window.cursor_column.read().await, @@ -385,9 +386,15 @@ impl Ivy { } let new_scroll_top = *self.window.read().await.scroll_top.read().await; - if old_scroll_top != new_scroll_top { - self.terminal.write().await.clear().await?; - self.draw().await?; + let height = *self.terminal.read().await.height.read().await - 1; + if new_scroll_top != old_scroll_top { + let difference = new_scroll_top as isize - old_scroll_top as isize; + if (difference.abs() as usize) < height { + self.terminal.write().await.scroll(difference).await?; + } else { + self.terminal.write().await.clear().await?; + self.draw().await?; + } } Ok(()) |