summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Heinrich <christoph.heinrich@student.tugraz.at>2023-08-31 23:16:30 +0200
committerKacper Michajłow <kasper93@gmail.com>2024-03-21 03:08:52 +0100
commit97e16be29406cbe73219cbf471132d7940b93c63 (patch)
tree0e1183243bf99af57e8190446d1e31a31ee0ad62
parent0c8f3bc73ca3edf1970dd68aa5e085064968bdfd (diff)
downloadmpv-97e16be29406cbe73219cbf471132d7940b93c63.tar.bz2
mpv-97e16be29406cbe73219cbf471132d7940b93c63.tar.xz
stats.lua: use term-size as terminal output size
The terminal output was static in size with no way of automatically adjusting it to the current terminal size. The new term-size property makes truly automatic adjustment possible.
-rw-r--r--player/lua/stats.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/player/lua/stats.lua b/player/lua/stats.lua
index a993753ea3..4d25a6c6bf 100644
--- a/player/lua/stats.lua
+++ b/player/lua/stats.lua
@@ -1065,8 +1065,9 @@ end
-- content : table of the content where each entry is one line
-- apply_scroll: scroll the content
local function finalize_page(header, content, apply_scroll)
- local term_width = o.term_width_limit or 80
- local term_height = o.term_height_limit or 24
+ local term_size = mp.get_property_native("term-size", {})
+ local term_width = o.term_width_limit or term_size.w or 80
+ local term_height = o.term_height_limit or term_size.h or 24
local from, to = 1, #content
if apply_scroll and term_height > 0 then
-- Up to 40 lines for libass because it can put a big performance toll on
@@ -1483,7 +1484,7 @@ if o.bindlist ~= "no" then
mp.add_timeout(0, function() -- wait for all other scripts to finish init
o.ass_formatting = false
o.no_ass_indent = " "
- o.term_size.w = width
+ o.term_size = { w = width , h = 0}
io.write(keybinding_info(false, true) .. "\n")
mp.command("quit")
end)