mirror of
https://github.com/mpv-player/mpv
synced 2024-09-28 17:52:52 +02:00
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:
parent
5d2f1da7c5
commit
ab6fac43b4
@ -129,6 +129,12 @@ static void term_osd_set_status(struct MPContext *mpctx, const char *text)
|
|||||||
{
|
{
|
||||||
talloc_free(mpctx->term_osd_status);
|
talloc_free(mpctx->term_osd_status);
|
||||||
mpctx->term_osd_status = talloc_strdup(mpctx, text);
|
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);
|
term_osd_update(mpctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user