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.
This commit is contained in:
Guido Cella 2024-10-29 21:23:39 +01:00 committed by Kacper Michajłow
parent 10789fae1f
commit ce4a804a7d
1 changed files with 2 additions and 3 deletions

View File

@ -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