[LyX features/biginset] Avoid metrics computation on resize when width did not change
commit f7218cec188cad2dbf68de47ad4345fcddf1bdb8 Author: Jean-Marc Lasgouttes Date: Mon Nov 27 11:46:52 2023 +0100 Avoid metrics computation on resize when width did not change Entering a math inset triggers a work area reize because the math toobars appear automatically. However, by default these toolbars are at the bottom of the screen and their presence does not change the typesetting of paragraphs. Therefore it is useful to avoid a call to updateMetrics() in the case where the width of the work area did not change. Part of bug #12297. --- src/BufferView.cpp | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 34be860691..c03f928c4d 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2484,14 +2484,16 @@ void BufferView::clearSelection() void BufferView::resize(int width, int height) { - // Update from work area - width_ = width; height_ = height; + // Update metrics only if width has changed + if (width != width_) { + width_ = width; - // Clear the paragraph height cache. - d->par_height_.clear(); - // Redo the metrics. - updateMetrics(); + // Clear the paragraph height cache. + d->par_height_.clear(); + // Redo the metrics. + updateMetrics(); + } } @@ -3131,6 +3133,8 @@ void BufferView::updateMetrics(bool force) if (!ready()) return; + //LYXERR0("updateMetrics " << _v_(force)); + Text & buftext = buffer_.text(); pit_type const lastpit = int(buftext.paragraphs().size()) - 1; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX features/biginset] Avoid metrics computation on resize when width did not change
The branch, biginset, has been updated. - Log - commit 84b24971c84544bcfcf097dec421924d6f15add9 Author: Jean-Marc Lasgouttes Date: Mon Nov 27 11:46:52 2023 +0100 Avoid metrics computation on resize when width did not change Entering a math inset triggers a work area reize because the math toobars appear automatically. However, by default these toolbars are at the bottom of the screen and their presence does not change the typesetting of paragraphs. Therefore it is useful to avoid a call to updateMetrics() in the case where the width of the work area did not change. Part of bug #12297. diff --git a/src/BufferView.cpp b/src/BufferView.cpp index f582ef9..36f8c23 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2487,14 +2487,16 @@ void BufferView::clearSelection() void BufferView::resize(int width, int height) { - // Update from work area - width_ = width; height_ = height; + // Update metrics only if width has changed + if (width != width_) { + width_ = width; - // Clear the paragraph height cache. - d->par_height_.clear(); - // Redo the metrics. - updateMetrics(); + // Clear the paragraph height cache. + d->par_height_.clear(); + // Redo the metrics. + updateMetrics(); + } } @@ -3116,6 +3118,8 @@ void BufferView::updateMetrics(bool force) if (!ready()) return; + //LYXERR0("updateMetrics " << _v_(force)); + Text & buftext = buffer_.text(); pit_type const lastpit = int(buftext.paragraphs().size()) - 1; --- Summary of changes: src/BufferView.cpp | 16 ++-- 1 files changed, 10 insertions(+), 6 deletions(-) hooks/post-receive -- Repository for new features -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs