bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] [PATCH] Make the marquee a proper marquee


From: Alex Henrie
Subject: [Bug-wget] [PATCH] Make the marquee a proper marquee
Date: Wed, 24 Jun 2015 16:50:27 -0600

This patch gives the user plenty of time to see the beginning and the
end of the filename before the edge scrolls out of view.

The marquee initially appears in the middle of the available space.
---
 src/progress.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/progress.c b/src/progress.c
index 465bebf..61b635d 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -967,16 +967,31 @@ create_image (struct bar_progress *bp, double 
dl_total_time, bool done)
       if ((orig_filename_cols > MAX_FILENAME_COLS + MIN_SCROLL_TEXT) &&
           !opt.noscroll &&
           !done)
-        offset_cols = ((int) bp->tick) % (orig_filename_cols - 
MAX_FILENAME_COLS + 1);
+        {
+          offset_cols = ((int) bp->tick + orig_filename_cols + 
MAX_FILENAME_COLS / 2)
+                        % (orig_filename_cols + MAX_FILENAME_COLS);
+          if (offset_cols > orig_filename_cols)
+            {
+              padding = MAX_FILENAME_COLS - (offset_cols - orig_filename_cols);
+              memset(p, ' ', padding);
+              p += padding;
+              offset_cols = 0;
+            }
+          else
+            padding = 0;
+        }
       else
-        offset_cols = 0;
+        {
+          padding = 0;
+          offset_cols = 0;
+        }
       offset_bytes = cols_to_bytes (bp->f_download, offset_cols, cols_ret);
       bytes_in_filename = cols_to_bytes (bp->f_download + offset_bytes,
-                                         MAX_FILENAME_COLS,
+                                         MAX_FILENAME_COLS - padding,
                                          cols_ret);
       memcpy (p, bp->f_download + offset_bytes, bytes_in_filename);
       p += bytes_in_filename;
-      padding = MAX_FILENAME_COLS - *cols_ret;
+      padding = MAX_FILENAME_COLS - (padding + *cols_ret);
       for (;padding;padding--)
           *p++ = ' ';
       *p++ = ' ';
-- 
2.4.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]