Make smooth scrolling take the top of the scroll region in
authorMatthew Mondor <mmondor@pulsar-zone.net>
Thu, 14 Apr 2022 23:53:47 +0000 (23:53 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Thu, 14 Apr 2022 23:53:47 +0000 (23:53 +0000)
consideration

MATT/TODO.txt
hacks/analogterm.c

index 97c1f5d..0d871d2 100644 (file)
@@ -13,16 +13,19 @@ TODO
   - 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.
-  - In tmux/screen, if no title bar or if it's a the top, it works, but then
-    it's a bit strange to see the top bar move and refresh.  Only applying the
-    offset within the scroll range may possibly help.
-  - Works quite nicely for log display with sleepycat(1).  A similar
-    application that delays at the line level, or simulates microdelays using
-    special characters might allow more precise speed tuning.
   - 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
     could help yet.  Could also be left as-is...
+  - It now can be enabled using ESC [?4h and disabled with [?4l.  Some
+    applications may inadvertently disable it like dialog.  It would be good
+    to have a command line option to enable it by default and prevent
+    disabling it.  dialog(1) appears to disable it.
+  - Despite smooth scrolling taking the scroll region's top in consideration,
+    since tmux(1) doesn't use it to protect its status bar, smooth scrolling
+    works when it's configured to put its status bar at the top rather than at
+    the bottom, but a strange refresh artefact at the top happens.  tmux(1)
+    just redisplays its bar after scrolling.
 - Various latin characters look strange and could be improved.
 - Links appears to enter DEC Special Graphics for some reason and to not exit
   it.  This does not happen under tmux(1).
index 3530d13..2ec2ef7 100644 (file)
@@ -746,6 +746,7 @@ analogterm_one_frame (analogterm_sim_t *sim)
     for (textrow = 0; textrow < 25; textrow++) {
       int row;
       int rowmul = textrow * 8;
+      int soffset = (textrow >= st->scroll_top ? smooth_scroll_offset : 0);
 
       for (row = rowmul; row < rowmul + 8; row++) {
         signed char *pp;
@@ -766,7 +767,7 @@ analogterm_one_frame (analogterm_sim_t *sim)
         * high enough that it would be possible to implement smooth scrolling
         * by sliding a window.
         */
-       pp=&sim->inp->signal[row + ANALOGTV_TOP + smooth_scroll_offset + 3]
+       pp=&sim->inp->signal[row + ANALOGTV_TOP + soffset + 3]
            [ANALOGTV_PIC_START + 100];
        for (col = 0; col < 80; col++) {
             int rev, level, olevel, iblink;