mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
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.
This commit is contained in:
parent
d5933fc5b5
commit
508518ad95
@ -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<char_type>(change.type) };
|
||||
// 1 byte is enough to encode Change::Type
|
||||
|
@ -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_; }
|
||||
|
@ -1857,7 +1857,6 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type const pit, int const
|
||||
return;
|
||||
}
|
||||
|
||||
BufferParams const & bparams = bv_->buffer().params();
|
||||
int const ww = bv_->workHeight();
|
||||
Cursor const & cur = bv_->cursor();
|
||||
DocIterator sel_beg = cur.selectionBegin();
|
||||
@ -1923,7 +1922,7 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type const pit, int const
|
||||
}
|
||||
|
||||
// Row signature; has row changed since last paint?
|
||||
row.setCrc(pm.computeRowSignature(row, bparams));
|
||||
row.setCrc(pm.computeRowSignature(row, *bv_));
|
||||
bool row_has_changed = row.changed()
|
||||
|| bv_->hadHorizScrollOffset(text_, pit, row.pos());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user