From 3c7c63376fbfcd3a120d32d53cba81c890183a9d Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 3 Jun 2016 11:21:09 +0200 Subject: [PATCH] Take inset dimension into account in row signature In some cases, the insets may change height or width without changing the other apsects of the row. Fixes bug #6991 and #10182. (cherry picked from commit 508518ad95a7fd7581bd4affd389dbe7bd6d09f1) --- src/ParagraphMetrics.cpp | 15 +++++++++++---- src/ParagraphMetrics.h | 4 ++-- src/TextMetrics.cpp | 3 +-- status.22x | 3 +++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/ParagraphMetrics.cpp b/src/ParagraphMetrics.cpp index 56660919a2..1fd248f663 100644 --- a/src/ParagraphMetrics.cpp +++ b/src/ParagraphMetrics.cpp @@ -86,13 +86,20 @@ void ParagraphMetrics::reset(Paragraph const & par) size_t ParagraphMetrics::computeRowSignature(Row const & row, - BufferParams const & bparams) const + BufferView const & bv) const { boost::crc_32_type crc; for (pos_type i = row.pos(); i < row.endpos(); ++i) { - char_type const b[] = { par_->getChar(i) }; - crc.process_bytes(b, sizeof(char_type)); - if (bparams.track_changes) { + if (par_->isInset(i)) { + Inset const * in = par_->getInset(i); + Dimension const d = in->dimension(bv); + int const b[] = { d.wid, d.asc, d.des }; + crc.process_bytes(b, sizeof(b)); + } else { + char_type const b[] = { par_->getChar(i) }; + crc.process_bytes(b, sizeof(char_type)); + } + if (bv.buffer().params().track_changes) { Change change = par_->lookupChange(i); char_type const b[] = { static_cast(change.type) }; // 1 byte is enough to encode Change::Type diff --git a/src/ParagraphMetrics.h b/src/ParagraphMetrics.h index d8935cc753..7244e2a2d3 100644 --- a/src/ParagraphMetrics.h +++ b/src/ParagraphMetrics.h @@ -85,8 +85,8 @@ public: /// bool hfillExpansion(Row const & row, pos_type pos) const; - /// - size_t computeRowSignature(Row const &, BufferParams const & bparams) const; + /// + size_t computeRowSignature(Row const &, BufferView const & bv) const; /// int position() const { return position_; } diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index fdf0da6926..dd970e21dd 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1874,7 +1874,6 @@ void TextMetrics::draw(PainterInfo & pi, int x, int y) const void TextMetrics::drawParagraph(PainterInfo & pi, pit_type const pit, int const x, int y) const { - BufferParams const & bparams = bv_->buffer().params(); ParagraphMetrics const & pm = par_metrics_[pit]; if (pm.rows().empty()) return; @@ -1948,7 +1947,7 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type const pit, int const // Row signature; has row changed since last paint? if (pi.pain.isDrawingEnabled()) - row.setCrc(pm.computeRowSignature(row, bparams)); + row.setCrc(pm.computeRowSignature(row, *bv_)); bool row_has_changed = row.changed() || rowSlice == bv_->lastRowSlice(); diff --git a/status.22x b/status.22x index 842d2f91da..6da8c02876 100644 --- a/status.22x +++ b/status.22x @@ -104,6 +104,9 @@ What's new - Fix display of collapsable insets when the same document is shown in two views with different width (bug 9756). +- fix display glitches when editing changes the dimension of insets + (bug 6691). + - Raise GuiView on buffer switch to bring it topmost in multi-window mode. - Fix cursor position after Redo of a document settings change (bug -- 2.39.5