From ce4a804a7d4e054c992c514afae8a42039b5b987 Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Tue, 29 Oct 2024 21:23:39 +0100 Subject: [PATCH] console.lua: factor the bottom margin in line calculations This is more important now that the margin is bigger due to the scaling with the window. --- player/lua/console.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/player/lua/console.lua b/player/lua/console.lua index d3724af427..0421ec2501 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -79,6 +79,7 @@ local line = '' local cursor = 1 local default_prompt = '>' local prompt = default_prompt +local bottom_left_margin = 6 local default_id = 'default' local id = default_id local histories = {[id] = {}} @@ -275,7 +276,7 @@ local function calculate_max_log_lines() select(2, mp.get_property('term-status-msg'):gsub('\\n', '')) end - return math.floor(select(2, get_scaled_osd_dimensions()) + return math.floor((select(2, get_scaled_osd_dimensions()) - bottom_left_margin) * (1 - global_margins.t - global_margins.b) / opts.font_size -- Subtract 1 for the input line and 0.5 for the empty @@ -513,8 +514,6 @@ local function update() local screenx, screeny = get_scaled_osd_dimensions() - local bottom_left_margin = 6 - local coordinate_top = math.floor(global_margins.t * screeny + 0.5) local clipping_coordinates = '0,' .. coordinate_top .. ',' .. screenx .. ',' .. screeny