diff --git a/player/lua/console.lua b/player/lua/console.lua index 686d04ff3b9d8..e4495a13471cf 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -504,8 +504,11 @@ local function update() dpi_scale = dpi_scale * opts.scale - local screenx, screeny = mp.get_osd_size() - screenx = screenx / dpi_scale + local screenx, screeny, aspect = mp.get_osd_size() + local bottom_left_margin = 6 + screenx = (screenx - bottom_left_margin - + mp.get_property_native('osd-margin-x') * screenx / 720 / aspect) + / dpi_scale screeny = screeny / dpi_scale -- Clear the OSD if the REPL is not active @@ -546,7 +549,7 @@ local function update() local lines_max = calculate_max_log_lines() -- Estimate how many characters fit in one line - local width_max = math.ceil(screenx / opts.font_size * get_font_hw_ratio()) + local width_max = math.floor(screenx / opts.font_size * get_font_hw_ratio()) local suggestions, rows = format_table(suggestion_buffer, width_max, lines_max) local suggestion_ass = style .. styles.suggestion .. suggestions @@ -566,7 +569,7 @@ local function update() ass:new_event() ass:an(1) - ass:pos(6, screeny - 6 - global_margins.b * screeny) + ass:pos(bottom_left_margin, screeny - bottom_left_margin - global_margins.b * screeny) ass:append(log_ass .. '\\N') if #suggestions > 0 then ass:append(suggestion_ass .. '\\N') @@ -579,7 +582,7 @@ local function update() -- cursor appear in front of the text. ass:new_event() ass:an(1) - ass:pos(6, screeny - 6 - global_margins.b * screeny) + ass:pos(bottom_left_margin, screeny - bottom_left_margin - global_margins.b * screeny) ass:append(style .. '{\\alpha&HFF&}' .. ass_escape(prompt) .. ' ' .. before_cur) ass:append(cglyph) ass:append(style .. '{\\alpha&HFF&}' .. after_cur)