Skip to content

docFromDisplay() method returning wrong visible doc line from an out of bound display line #6

Description

@DebanKsahu

Describe the bug

  • As per the need the docFromDisplay() method from DisplayLineMap class return 0 based doc line from the 0 based input display line. But there is bug on handling the out of bound display line in the docFromDisplay() method.
  • Whenever we pass any out of bound display line to the function which is >= totalDisplayLine it returns logicalSize-1 where logicalSize is total active lines currently handled by DisplayLineMap class. But the problem is for this to be true the last line should be visible, otherwise it returns false answer.
  • Take displayHeight = [1,1,0,0,0,1,1,1,0,0] as an example. Here logicalSize=10. When I want to compute docFromDisplay(90) then it will return 9 because 90>=totalDisplayLine (totalDisplayLine=5), but it should return the last visible line which is 7.

To Reproduce
This bug is theoretical and only produced through specific edge cases.

Environment (please complete the following information):

  • OS: Windows 11
  • Java: 21
  • App version / commit SHA: 1.15.0
  • Module/area: editor-core
  • Run mode: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions