From 6317521b6f5626ad03c9b247bdde72d7123f1865 Mon Sep 17 00:00:00 2001 From: Matthew Mondor Date: Fri, 15 Apr 2022 02:30:02 +0000 Subject: [PATCH] Update TODO and add a not-yet configurable smooth scroll speed parameter --- MATT/TODO.txt | 3 ++- hacks/analogterm.c | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/MATT/TODO.txt b/MATT/TODO.txt index 0d871d2..6fa3466 100644 --- a/MATT/TODO.txt +++ b/MATT/TODO.txt @@ -12,7 +12,8 @@ TODO - Now that upwards smooth scrolling has been implemented: - May be possible to do the same for downwards - May need to support sending XOFF/XON to control speed, if too fast it - still jump scrolls. + still jump scrolls, because the next scroll operation is requested before + the smooth scrolling offset animation expires. - When the cursor is down and a command is typed then the whole screen quickly refreshed, the scroll jump is a bit strange, similarly to a vertically desynched TV. Unsure if some control flow somewhere or timer diff --git a/hacks/analogterm.c b/hacks/analogterm.c index 1ce8c3a..f1f0f5d 100644 --- a/hacks/analogterm.c +++ b/hacks/analogterm.c @@ -118,6 +118,8 @@ at_insert(analogterm_state_t *st, int many) } static int smooth_scroll_offset = 0; +static int smooth_scroll_offset_cnt = 0; +static int smooth_scroll_offset_cnt_start = 1; /* Should be configurable */ static int cursor_waitnext = 2; static bool cursor_laststate = false; @@ -262,8 +264,11 @@ at_scroll_range(analogterm_state_t *st, int offset) for (y = st->scroll_bottom + 1 + offset; y <= st->scroll_bottom; y++) at_clear(st, 0, y, 80); - if (smooth) + if (smooth) { smooth_scroll_offset = 8; + smooth_scroll_offset_cnt = + smooth_scroll_offset_cnt_start; + } } else { /* Bottom to top moving lines down, blank at top */ for (y = st->scroll_bottom - offset; y >= st->scroll_top; y--) @@ -832,8 +837,12 @@ analogterm_one_frame (analogterm_sim_t *sim) } } at_drawcursor(sim); - if (smooth_scroll_offset > 0) - smooth_scroll_offset--; + if (smooth_scroll_offset > 0) { + if (--smooth_scroll_offset_cnt == 0) { + smooth_scroll_offset--; + smooth_scroll_offset_cnt = smooth_scroll_offset_cnt_start; + } + } analogtv_reception_update(&sim->reception); { const analogtv_reception *rec = &sim->reception; -- 2.9.0