rxi / lite

A lightweight text editor written in Lua
MIT License
7.42k stars 353 forks source link

[bug] DocView:get_line_screen_position() returns inacurate x-coordinate #313

Open SwissalpS opened 1 year ago

SwissalpS commented 1 year ago

to reproduce:

local omr = DocView.on_mouse_released function DocView:on_mouse_released(b, x, y) local line, col = self:resolve_screen_position(x, y) local x2, y2 = self:get_line_screen_position(line, col) print('x: ' .. x .. ' x2: ' .. x2) return true end


- launch lite from terminal
- open a document
- click in the *middle* of a line and read output
x ~= x2
a small diff can be expected from rounding and a bigger one
can be expected when clicking out to the right of text.
In my tests the diff was over 100 pixels.