fix: revert draw gating; replace frame-count scroll with wall-clock timer
- Revert src/main.rs to draw-at-top-of-loop (original structure) so auto-scrolling is no longer coupled to event rate. Lock is released before blocking on recv() so the network task is never starved. - Replace ticks_until_scroll counter in on_ui_scroll_tick() with an Instant + Duration (default 100ms). Scroll now advances at a fixed wall-clock rate (10 chars/sec) regardless of draw rate or tick rate, which is the correct long-term fix for the animation regression. - Update tests: assert scroll_interval == 100ms in default/new tests; rewrite test_on_ui_scroll_tick to cover zero-interval (always fires) and long-interval (suppressed) cases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C3FpbniZme9mJqgFkMVowz
This commit is contained in:
1 parent
a72b2991fd
commit
6f697f64f4
3 files changed
+25
-21
No files matched your search
+5
-7
@@ -276,12 +276,12 @@ async fn start_ui(
|
||||
|
||||
let input_events = Events::new();
|
||||
|
||||
{
|
||||
let mut app = app.lock().await;
|
||||
terminal.draw(|f| ui(f, &mut app))?;
|
||||
}
|
||||
|
||||
loop {
|
||||
{
|
||||
let mut app = app.lock().await;
|
||||
terminal.draw(|f| ui(f, &mut app))?;
|
||||
}
|
||||
|
||||
match input_events.next()? {
|
||||
Some(InputEvent::KeyEvent(key)) => {
|
||||
let mut app = app.lock().await;
|
||||
@@ -291,13 +291,11 @@ async fn start_ui(
|
||||
}
|
||||
|
||||
handlers::handle_events(key, &mut app);
|
||||
terminal.draw(|f| ui(f, &mut app))?;
|
||||
}
|
||||
|
||||
Some(InputEvent::Tick) => {
|
||||
let mut app = app.lock().await;
|
||||
app.on_tick().await;
|
||||
terminal.draw(|f| ui(f, &mut app))?;
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user