Code

status_bar: fix display_remaining_time while seeking
authorMax Kellermann <max@duempel.org>
Sat, 14 Nov 2009 01:44:45 +0000 (02:44 +0100)
committerMax Kellermann <max@duempel.org>
Sat, 14 Nov 2009 01:44:45 +0000 (02:44 +0100)
If the display_remaining_time option is enabled, apply this setting
even during seeking.

NEWS
src/status_bar.c

diff --git a/NEWS b/NEWS
index 4e7906d3acef0a5d26044e9cd978580f1950987d..c48e9dfe360fedebfdc2c4322139c05e7960aace 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ ncmpc 0.16 - not yet released
 * screen_browser: different colors for directories and playlists
 * screen_browser: display song duration
 * screen_queue: move ranges with one single "move" command
+* status_bar: fix display_remaining_time while seeking
 
 
 ncmpc 0.15 - 2009-09-24
index 2803b28745a8f1214ad69759402f781a89bb2277..2bb3057479d312b66532937fafc5f2259851e166 100644 (file)
@@ -152,12 +152,14 @@ status_bar_paint(struct status_bar *p, const struct mpd_status *status,
                        if (seek_id >= 0 &&
                            seek_id == mpd_status_get_song_id(status))
                                elapsedTime = seek_target_time;
-                       else if (options.display_remaining_time)
-                               elapsedTime = total_time -
-                                       mpd_status_get_elapsed_time(status);
                        else
                                elapsedTime = mpd_status_get_elapsed_time(status);
 
+                       if (options.display_remaining_time)
+                               elapsedTime = elapsedTime < total_time
+                                       ? total_time - elapsedTime
+                                       : 0;
+
                        /* display bitrate if visible-bitrate is true */
 #ifndef NCMPC_MINI
                        format_bitrate(bitrate, sizeof(bitrate), status);