From d5fce546a416539d101a33226c1d4a9ffcd737d5 Mon Sep 17 00:00:00 2001 From: Johannes Nixdorf Date: Wed, 15 Jan 2014 22:37:53 +0100 Subject: player: handle the corner cases in --term-osd-bar correctly With the old code and pos == width - 2 one character too many is drawn. --- player/osd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'player') diff --git a/player/osd.c b/player/osd.c index f3096ea5cf..06253df7ee 100644 --- a/player/osd.c +++ b/player/osd.c @@ -110,8 +110,8 @@ static void add_term_osd_bar(struct MPContext *mpctx, char **line, int width) if (width < 5) return; - int pos = get_current_pos_ratio(mpctx, false) * (width - 2); - pos = MPCLAMP(pos, 0, width - 2); + int pos = get_current_pos_ratio(mpctx, false) * (width - 3); + pos = MPCLAMP(pos, 0, width - 3); bstr chars = bstr0(opts->term_osd_bar_chars); bstr parts[5]; @@ -122,7 +122,7 @@ static void add_term_osd_bar(struct MPContext *mpctx, char **line, int width) for (int n = 0; n < pos; n++) saddf(line, "%.*s", BSTR_P(parts[1])); saddf(line, "%.*s", BSTR_P(parts[2])); - for (int n = 0; n < width - 2 - pos - 1; n++) + for (int n = 0; n < width - 3 - pos; n++) saddf(line, "%.*s", BSTR_P(parts[3])); saddf(line, "%.*s", BSTR_P(parts[4])); } -- cgit v1.2.3