perf: repaint the whole console only when something disturbed it

Console upkeep still runs every second, but a full repaint follows only when it
had to re-quiet the kernel, take the terminal back or noticed a new font, after
reconnecting, and every five seconds as a safety net.
This commit is contained in:
Willem Vanhulle committed 2026-10-21 13:24:35 +02:00
1 parent 552d1170ed
commit a071b2d065
5 files changed
+42 -29

No files matched your search

+8 -3
View File
@@ -16,7 +16,8 @@ use crate::{
screen_settings::font_glyphs::Glyphs,
};
const FULL_REPAINT_INTERVAL: Duration = Duration::from_secs(1);
const CONSOLE_UPKEEP_INTERVAL: Duration = Duration::from_secs(1);
const FULL_REPAINT_INTERVAL: Duration = Duration::from_secs(5);
pub struct LiveDesk {
console: Console,
@@ -83,8 +84,8 @@ impl ConsoleDesk for LiveDesk {
self.follow_requests(true);
}
fn keep_console_up(&mut self) {
self.console.keep_up();
fn keep_console_up(&mut self) -> bool {
self.console.keep_up()
}
fn take_clear_request(&mut self) -> bool {
@@ -96,6 +97,10 @@ impl ConsoleDesk for LiveDesk {
}
}
pub fn console_upkeep_inputs() -> impl Stream<Item = ScreenInput> {
periodic_inputs(CONSOLE_UPKEEP_INTERVAL, || ScreenInput::ConsoleUpkeep)
}
pub fn full_repaint_inputs() -> impl Stream<Item = ScreenInput> {
periodic_inputs(FULL_REPAINT_INTERVAL, || ScreenInput::FullRepaint)
}