From ad64a9b221c04d377c6e93eefbed473f582c7112 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 14 Nov 2009 02:44:45 +0100 Subject: [PATCH] status_bar: fix display_remaining_time while seeking If the display_remaining_time option is enabled, apply this setting even during seeking. --- NEWS | 1 + src/status_bar.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 4e7906d..c48e9df 100644 --- 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 diff --git a/src/status_bar.c b/src/status_bar.c index 2803b28..2bb3057 100644 --- a/src/status_bar.c +++ b/src/status_bar.c @@ -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); -- 2.30.2