Skip to content

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

@SwissalpS

Description

@SwissalpS

to reproduce:

  • clone/checkout master at [38bd9b3] (latest as of this writing)
  • build it
  • add a plugin like this:
local DocView = require "core.docview"

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions