History

console.lua: use math.ceil in determine_hovered_item()

Replace the rounding to calculate the hovered line with ceil which is what you would expect to work. Rounding worked better before because it compensated for the errors fixed by the previous 2 commits.

Guido Cella committed 2 years ago

Commit b4024181 parent ce4a8041 file · +1 −1Browse files

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

Unified · Split

player/lua/console.lua+1−1
@@ -825,7 +825,7 @@ local function determine_hovered_item() · 824 unmodified lines
825 -- Calculate how many lines could be printed without decreasing them for825 -- Calculate how many lines could be printed without decreasing them for
826 -- the input line and OSC.826 -- the input line and OSC.
827 local max_lines = height / opts.font_size827 local max_lines = height / opts.font_size
828 local clicked_line = math.floor(y / height * max_lines + .5)828 local clicked_line = math.ceil(y / height * max_lines)
829 829
830 local offset = first_match_to_print - 1830 local offset = first_match_to_print - 1
831 local min_line = 1831 local min_line = 1

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