How often do people change the size of the screen buffer while a command is running?
Rarely I think, for example when you notice a huge file is being downloaded slowly and you enlarge the window in order to have a better granularity on the progress bar. Probably instead of risking a performance drawback on some (slow) machines a better way would be call it rarely (every 5 seconds or so would still be enough I think).
Heiko
Right. The previous patch was kind of a worst-case test.
Attached is a patch that checks the screen width approximately every two seconds in the Windows build. I don't know if this is what Hrvoje had in mind. And of course the interval can be tweaked.
Cheers
Index: progress.c
===================================================================
RCS file: /pack/anoncvs/wget/src/progress.c,v
retrieving revision 1.43
diff -u -r1.43 progress.c
--- progress.c 2004/01/28 01:02:26 1.43
+++ progress.c 2004/01/29 20:20:35
@@ -452,6 +452,11 @@
double last_screen_update; /* time of the last screen update,
measured since the beginning of
download. */
+#ifdef WINDOWS
+ double last_screen_width_check; /* time of the last screen width
+ check, measured since the
+ beginning of download. */
+#endif /* WINDOWS */
int width; /* screen width we're using at the
time the progress gauge was
@@ -555,6 +560,15 @@
bp->total_length = bp->initial_length + bp->count;
update_speed_ring (bp, howmuch, dltime);
+
+#ifdef WINDOWS
+ /* Under Windows, check to see if the screen width has changed no more
+ than once every two seconds. */
+ if (dltime - bp->last_screen_width_check > 2000) {
+ received_sigwinch = 1;
+ bp->last_screen_width_check = dltime;
+ }
+#endif /* WINDOWS */
/* If SIGWINCH (the window size change signal) been received,
determine the new screen size and update the screen. */
