2015-07-10 10:35 GMT-06:00 Darshit Shah <[email protected]>:
> The mail does not contain the commit message in the ChangeLog format.
> Also, it would be great if you could send the patch as an attachment,
> since lines are often mangled in emails.

I've rewritten the commit message. `git send-email` prevents line and
whitespace mangling, but I am sending the new patch as an attachment
anyway.

-Alex
From 5372f8d57c0c3a837544e379473d65023522e453 Mon Sep 17 00:00:00 2001
From: Alex Henrie <[email protected]>
Date: Fri, 10 Jul 2015 10:50:08 -0600
Subject: [PATCH] Make the filename marquee a proper marquee

* src/progress.c: Start the marquee in the middle of the available space
  and do not restart it until all of the text has scrolled out of view.
---
 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.5

Reply via email to