]> git.lyx.org Git - lyx.git/commit
Fix up a4d9315b: handle metrics of not visible paragraphs
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 17 May 2024 13:42:08 +0000 (15:42 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 17 May 2024 15:39:09 +0000 (17:39 +0200)
commit145af7c2ac1eb2c5ec5102a7a11cb740be7b3c43
treeafe374adcd51c6947f3ae76c4fb627ea494420bb
parent5a10c652a36cfeaaebc2df9049beb421a4552545
Fix up a4d9315b: handle metrics of not visible paragraphs

The code is not ready for situations where some paragraphs that are
not visible have metrics available. This has been made visible by
a4d9315b, which removes a couple of full metrics updates: the screen
was not correctly scrolled after a scrollToCursor() call.

In PararagraphMetrics, some methods are added to be able to handle the
fact that paragraphs have or do not have a position.

In TextMetrics, a new method returns the first visible paragraph.

Finally, in BufferView::updateMetrics, the paragraphs' positions are
reset (in the case where everything is not cleared) and some care is
taken to skip the ones that are not relevant.

The assumption outside of this method is that all the paragraphs that
are in the TextMetrics are visible (we are talking about top-level
TextMetrics here). This could be changed (in order to avoid
recomputing paragraph metrics), but the cost is high in terms of
complexity and it is not clear that the gain in terms of performance
would be important.
src/BufferView.cpp
src/ParagraphMetrics.cpp
src/ParagraphMetrics.h
src/TextMetrics.cpp
src/TextMetrics.h