mirror of https://github.com/mpv-player/mpv
win32: SGR emulation: minor fixup on invalid sequence
This fixes two issues with invalid value after 38/48: - It was not detected correctly and ended up skipping 4 instead of 0. - The intent was to skip 0, but it's better to skip the rest. Behavior with valid 2/5 after 38/48 was correct and is unaffected.
This commit is contained in:
parent
b036e56e67
commit
77738ac6f5
|
@ -304,8 +304,11 @@ void mp_write_console_ansi(HANDLE wstream, char *buf)
|
||||||
attr |= stdoutAttrs & BACKGROUND_ALL;
|
attr |= stdoutAttrs & BACKGROUND_ALL;
|
||||||
} else if (p == 38 || p == 48) { // ignore and skip sub-values
|
} else if (p == 38 || p == 48) { // ignore and skip sub-values
|
||||||
// 256 colors: <38/48>;5;N true colors: <38/48>;2;R;G;B
|
// 256 colors: <38/48>;5;N true colors: <38/48>;2;R;G;B
|
||||||
if (n+1 < num_params)
|
if (n+1 < num_params) {
|
||||||
n += params[n+1] == 5 ? 2 : 2 ? 4 : 0;
|
n += params[n+1] == 5 ? 2
|
||||||
|
: params[n+1] == 2 ? 4
|
||||||
|
: num_params; /* unrecognized -> the rest */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue