1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Aesthetic changes to progress bar

This commit is contained in:
Darshit Shah 2014-11-19 22:55:22 +05:30
parent 7b43510fe3
commit d9f21b4b95
3 changed files with 20 additions and 3 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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);
}