diff options
author | Johannes Nixdorf <mixi@exherbo.org> | 2014-01-15 22:37:53 +0100 |
---|---|---|
committer | Johannes Nixdorf <mixi@exherbo.org> | 2014-01-15 23:12:46 +0100 |
commit | d5fce546a416539d101a33226c1d4a9ffcd737d5 (patch) | |
tree | ef36af21dfaebc85866f3c1afcd5807e369e908b | |
parent | 1d9c62b644a3f8da39802ed99dc27e85bdd47792 (diff) | |
download | mpv-d5fce546a416539d101a33226c1d4a9ffcd737d5.tar.bz2 mpv-d5fce546a416539d101a33226c1d4a9ffcd737d5.tar.xz |
player: handle the corner cases in --term-osd-bar correctly
With the old code and pos == width - 2 one character too many is drawn.
-rw-r--r-- | player/osd.c | 6 |
1 files changed, 3 insertions, 3 deletions
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])); } |