History

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.

Guido Cella committed 2 years ago

Commit ce4a8041 parent 10789fa1 file · +2 −3Browse files

Showing the changes to player/lua/console.lua (1 of 1 file). Show all

Unified · Split

player/lua/console.lua+2−3
@@ -79,6 +79,7 @@ local line = '' · 78 unmodified lines
7979 local cursor = 1
8080 local default_prompt = '>'
8181 local prompt = default_prompt
82+local bottom_left_margin = 6
8283 local default_id = 'default'
8384 local id = default_id
8485 local histories = {[id] = {}}
@@ -275,7 +276,7 @@ local function calculate_max_log_lines() · 190 unmodified lines
275276 select(2, mp.get_property('term-status-msg'):gsub('\\n', ''))
276277 end
277278
278− return math.floor(select(2, get_scaled_osd_dimensions())
279+ return math.floor((select(2, get_scaled_osd_dimensions()) - bottom_left_margin)
279280 * (1 - global_margins.t - global_margins.b)
280281 / opts.font_size
281282 -- Subtract 1 for the input line and 0.5 for the empty
@@ -513,8 +514,6 @@ local function update() · 231 unmodified lines
513514
514515 local screenx, screeny = get_scaled_osd_dimensions()
515516
516− local bottom_left_margin = 6
517−
518517 local coordinate_top = math.floor(global_margins.t * screeny + 0.5)
519518 local clipping_coordinates = '0,' .. coordinate_top .. ',' ..
520519 screenx .. ',' .. screeny

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t