diff --git a/src/ChangeLog b/src/ChangeLog index 742bf673..6208932e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2014-11-19 Darshit Shah <darnir@gmail.com> + + * progress.c (create_image): Do not scroll filename if amount of scrolling + is less than MIN_SCROLL_TEXT + * retr.c (fd_read_body): Do not print the directory prefix in the progress + bar + 2014-11-20 Tim Ruehsen <tim.ruehsen@gmx.de> * cookies.c, ftp-basic.c, ftp-ls.c, ftp.c, html-url.c, diff --git a/src/progress.c b/src/progress.c index 19f3e08d..e4890839 100644 --- a/src/progress.c +++ b/src/progress.c @@ -968,12 +968,17 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done) int *cols_ret = &col; int padding; - if (((orig_filename_cols > MAX_FILENAME_COLS) && !opt.noscroll) && !done) +#define MIN_SCROLL_TEXT 5 + 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); else 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, cols_ret); + bytes_in_filename = cols_to_bytes (bp->f_download + offset_bytes, + MAX_FILENAME_COLS, + cols_ret); memcpy (p, bp->f_download + offset_bytes, bytes_in_filename); p += bytes_in_filename; padding = MAX_FILENAME_COLS - *cols_ret; diff --git a/src/retr.c b/src/retr.c index 8d76b1bf..a388112c 100644 --- a/src/retr.c +++ b/src/retr.c @@ -265,11 +265,16 @@ fd_read_body (const char *downloaded_filename, int fd, FILE *out, wgint toread, if (opt.show_progress) { + const char *filename_progress; /* If we're skipping STARTPOS bytes, pass 0 as the INITIAL argument to progress_create because the indicator doesn't (yet) know about "skipping" data. */ wgint start = skip ? 0 : startpos; - progress = progress_create (downloaded_filename, start, start + toread); + if (opt.dir_prefix) + filename_progress = downloaded_filename + strlen (opt.dir_prefix) + 1; + else + filename_progress = downloaded_filename; + progress = progress_create (filename_progress, start, start + toread); progress_interactive = progress_interactive_p (progress); }