From ab6fac43b4bc34949bd9c4da8e911fc9f3489a32 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 6 Jul 2016 19:52:09 +0200 Subject: 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.) --- player/osd.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); } -- cgit v1.2.3