mplayer: fix multiline terminal OSD

When an OSD message printed to the terminal was multiple lines, the
second line overwrote the status line. If that second line was shorter
than the status line, awkward looking remains of the status line were
left on the terminal.

Fix this by writing an empty status line before printing the OSD
message. This will clear the status line text.

Also, print the status line again after the OSD message is printed -
this makes output consistent with the single-line OSD message case.

Remaining caveat: only the last line of a multiline OSD message is
cleared when the OSD message is removed. But this is probably fine.
This commit is contained in:
wm4 2012-10-28 01:56:49 +02:00
parent 6367ade0b0
commit 62dc32250e
1 changed files with 3 additions and 0 deletions

View File

@ -1480,8 +1480,11 @@ static void update_osd_msg(struct MPContext *mpctx)
if (strcmp(mpctx->terminal_osd_text, msg->msg)) {
talloc_free(mpctx->terminal_osd_text);
mpctx->terminal_osd_text = talloc_strdup(mpctx, msg->msg);
// Multi-line message => clear what will be the second line
write_status_line(mpctx, "");
mp_msg(MSGT_CPLAYER, MSGL_STATUS, "%s%s\n", opts->term_osd_esc,
mpctx->terminal_osd_text);
print_status(mpctx, MP_NOPTS_VALUE, false);
}
}
return;