mirror of https://github.com/mpv-player/mpv
msg: clear lines by printing spaces on MS Windows
On Windows, no ANSI control sequences are available, so we can't easily clear lines, move the cursor, etc. It's yet to be decided how this should be handled (emulate ANSI escapes in osdep/terminal-win.c, or provide abstracted terminal API functions to unify the Linux and Windows code). For now, this fixes the regression that was introduced earlier by the status line rewrite. It doesn't fix all aspects of status line and terminal OSD handling, as can be clearly seen by the unconditional use of terminal_erase_to_end_of_line further down the changed code. Fixes github issue #499 (sort of).
This commit is contained in:
parent
8eaf6c42ac
commit
7f744c9a16
|
@ -149,7 +149,13 @@ static void prepare_status_line(struct mp_log_root *root, char *new_status)
|
|||
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);
|
||||
if (terminal_erase_to_end_of_line[0]) {
|
||||
fprintf(f, "\r%s", terminal_erase_to_end_of_line);
|
||||
} else {
|
||||
// This code is for MS windows (no ANSI control sequences)
|
||||
get_screen_size();
|
||||
fprintf(f, "\r%*s\r", screen_width - 1, "");
|
||||
}
|
||||
// and clear all previous old lines
|
||||
for (size_t n = 1; n < clear_lines; n++)
|
||||
fprintf(f, "%s\r%s", terminal_cursor_up, terminal_erase_to_end_of_line);
|
||||
|
|
Loading…
Reference in New Issue