Skip to content

Commit d702e5f

Browse files
guidocellasfan5
authored andcommitted
console.lua: set compute_bounds and hidden at startup
There is no need to set them every time the width is calculated.
1 parent 4194522 commit d702e5f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

player/lua/console.lua

+5-4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ local cursor = 1
7878
local prompt
7979
local id
8080

81+
local overlay = mp.create_osd_overlay("ass-events")
82+
local width_overlay = mp.create_osd_overlay("ass-events")
83+
width_overlay.compute_bounds = true
84+
width_overlay.hidden = true
85+
8186
local histories = {}
8287
local history = {}
8388
local history_pos = 1
@@ -88,8 +93,6 @@ local histories_to_save = {}
8893
local log_buffers = {}
8994
local key_bindings = {}
9095
local dont_bind_up_down = false
91-
local overlay = mp.create_osd_overlay("ass-events")
92-
local width_overlay = mp.create_osd_overlay("ass-events")
9396
local global_margins = { t = 0, b = 0 }
9497
local input_caller
9598
local keep_open = false
@@ -328,8 +331,6 @@ local function calculate_max_item_width()
328331

329332
local osd_w, osd_h = get_scaled_osd_dimensions()
330333
local font = get_font()
331-
width_overlay.compute_bounds = true
332-
width_overlay.hidden = true
333334
width_overlay.res_x = osd_w
334335
width_overlay.res_y = osd_h
335336
width_overlay.data = "{\\fs" .. opts.font_size ..

0 commit comments

Comments
 (0)