From 5ff215c4df5c635b1ac3b39ab30be4760a070834 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Thu, 23 Apr 2020 16:29:18 +0300 Subject: stats.lua: don't disable terminal escape sequences on windows When stats.lua is used without a video window then it uses the terminal. On Windows, however, so far it disabled ansi escape sequences and used plaintext unless ANSICON env is set. It's unclear why it's disabled on windows, because at the time it was added it only used bold by default and mpv ansi emulation on windows already supported bold at that time. We can guess that it was disabled because if the same config is used on both linux and Windows, and it had complex escape sequences for stats.lue, then it would be emulated incorrectly on Windows. This shouldn't be an issue anymore, as the last two commits both enhance the emulation to be quite complete (and graceful where it's not), and also enable the much-more complete native VT terminal when possible (Windows 10). Just remove this windows exception at stats.lua. --- player/lua/stats.lua | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/player/lua/stats.lua b/player/lua/stats.lua index e76c496668..8e1940d75f 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -176,17 +176,6 @@ local function has_vo_window() end -local function has_ansi() - local is_windows = type(package) == 'table' - and type(package.config) == 'string' - and package.config:sub(1, 1) == '\\' - if is_windows then - return os.getenv("ANSICON") - end - return true -end - - -- Generate a graph from the given values. -- Returns an ASS formatted vector drawing as string. -- @@ -608,17 +597,10 @@ local function eval_ass_formatting() o.nl = o.no_ass_nl o.indent = o.no_ass_indent o.prefix_sep = o.no_ass_prefix_sep - if not has_ansi() then - o.b1 = "" - o.b0 = "" - o.it1 = "" - o.it0 = "" - else - o.b1 = o.no_ass_b1 - o.b0 = o.no_ass_b0 - o.it1 = o.no_ass_it1 - o.it0 = o.no_ass_it0 - end + o.b1 = o.no_ass_b1 + o.b0 = o.no_ass_b0 + o.it1 = o.no_ass_it1 + o.it0 = o.no_ass_it0 end end -- cgit v1.2.3