summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-01-14 17:37:55 +0100
committerwm4 <wm4@nowhere>2014-01-14 17:37:55 +0100
commitb51713e8e7938978a675abf1bedc2ff2d9ae7319 (patch)
treeb6172f71af6551c8178a3ad89dd40cd04de8a277
parentf3133e87042dbf53f3eb5d3f7605ba07ca175a9a (diff)
downloadmpv-b51713e8e7938978a675abf1bedc2ff2d9ae7319.tar.bz2
mpv-b51713e8e7938978a675abf1bedc2ff2d9ae7319.tar.xz
msg: don't clear term OSD lines that are not used
-rw-r--r--common/msg.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/common/msg.c b/common/msg.c
index 6b5bf4de91..ebb5051900 100644
--- a/common/msg.c
+++ b/common/msg.c
@@ -125,7 +125,6 @@ bool mp_msg_test(struct mp_log *log, int lev)
static void prepare_status_line(struct mp_log_root *root, char *new_status)
{
FILE *f = stderr;
- size_t old_lines = root->blank_lines;
size_t new_lines = 1;
char *tmp = new_status;
@@ -137,13 +136,16 @@ static void prepare_status_line(struct mp_log_root *root, char *new_status)
tmp++;
}
+ size_t old_lines = root->status_lines;
+ size_t clear_lines = MPMIN(MPMAX(new_lines, old_lines), root->blank_lines);
+
// clear the status line itself
fprintf(f, "\r%s", terminal_erase_to_end_of_line);
// and clear all previous old lines
- for (size_t n = 1; n < old_lines; n++)
+ for (size_t n = 1; n < clear_lines; n++)
fprintf(f, "%s\r%s", terminal_cursor_up, terminal_erase_to_end_of_line);
// skip "unused" blank lines, so that status is aligned to term bottom
- for (size_t n = new_lines; n < old_lines; n++)
+ for (size_t n = new_lines; n < clear_lines; n++)
fprintf(f, "\n");
root->status_lines = new_lines;