summaryrefslogtreecommitdiffstats
path: root/player/osd.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-07-06 19:52:09 +0200
committerwm4 <wm4@nowhere>2016-07-06 19:52:09 +0200
commitab6fac43b4bc34949bd9c4da8e911fc9f3489a32 (patch)
tree6d98ebb87ac427d4dddcfa8963b12c1448689475 /player/osd.c
parent5d2f1da7c53919a41557c65f2c3f7d6ded8698f4 (diff)
downloadmpv-ab6fac43b4bc34949bd9c4da8e911fc9f3489a32.tar.bz2
mpv-ab6fac43b4bc34949bd9c4da8e911fc9f3489a32.tar.xz
player: cut off status line on terminal width
If the status line is wider than the reported terminal size, then cut it off instead of causing the terminal to scroll down for the next line. This is done in the most primitive way possible, assuming ASCII. This was actually done in the past as far as I'm aware; do it again. (Probably differently.)
Diffstat (limited to 'player/osd.c')
-rw-r--r--player/osd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/player/osd.c b/player/osd.c
index 69b8dbb8b1..aa4d7243cc 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -129,6 +129,12 @@ static void term_osd_set_status(struct MPContext *mpctx, const char *text)
{
talloc_free(mpctx->term_osd_status);
mpctx->term_osd_status = talloc_strdup(mpctx, text);
+
+ int w = 80, h = 24;
+ terminal_get_size(&w, &h);
+ if (strlen(mpctx->term_osd_status) > w)
+ mpctx->term_osd_status[w] = '\0';
+
term_osd_update(mpctx);
}