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.)
This commit is contained in:
wm4 2016-07-06 19:52:09 +02:00
parent 5d2f1da7c5
commit ab6fac43b4
1 changed files with 6 additions and 0 deletions

View File

@ -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);
}