Improve layout performance of folded paragraphs - #1318
Conversation
There was a problem hiding this comment.
I have noticed a common pattern in all the tests you are making: they only cover fold on index = 0. I think you should reconsider the cases, as folding on index = 0 is an edge case. What happens when there is a line before the fold is never covered in these different cases present here.
Optimally we should test fold at the start, in the middle and at the end.
There was a problem hiding this comment.
Optimally we should test fold at the start, in the middle and at the end.
Well, folding 0, N still keeps the first paragraph visible. Its only possible to fold middle and end paragraphs.
The only change that could be made would be to expand the fold ranges in tests to not include just middle lines, but the end line as well. Less of an edge case considering how the folding really only treats line 0 as an edge with it being the minimum anchor line.
There was a problem hiding this comment.
By edge case, I meant that 0 is the minimum acceptable value. Optimally that kind of test should cover for min, max values and something in between. And invalid cases should also get some coverage like min-1, max+1 and why not cases where end < start and end == start.
|
I just finished reviewing, I wanted to point the method changes I have seen. These have changed but should be ok (mostly they refer to visibility, so it's normal it would change), maybe it should be documented somewhere still: getParagraphBoundsOnScreen This one the change could be risky if the caller supposed that empty() is the end of the visible lines (now empty() could be folded): These three I'm not sure it is advisable to change: getCaretBoundsOnScreen -> Caret needs still to get bounds, even on folded |
|
@Col-E I cannot answer on your last comment, so I put it here. I didn't create this library, so as far as exception is concerned I'm like you left to guess. Optional.empty() or -1 should be kept for valid input that returns non-existing. What I'd like to avoid is to change existing behaviour if not absolutely necessary (that also means exceptions). As this might impact library users. For visible cells it is most of the time intrinsically related to your change. So, there changing the behaviour is mostly acceptable (I have commented on those where I thought it is either not as clear or wrong). |
…ateParagraphGraphic/getParagraphGraphic not throw for oob indices
…c no longer throwing
…n_both_directions
bd89ca8 to
67ce473
Compare

Addressing #1317 - Description + video in the linked issue.