mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
Take Track-Change into account when calculating row signature.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19876 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c16a1874e2
commit
a40d6cd7bc
@ -94,18 +94,24 @@ void ParagraphMetrics::reset(Paragraph const & par)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_type ParagraphMetrics::calculateRowSignature(Row const & row)
|
size_type ParagraphMetrics::calculateRowSignature(Row const & row,
|
||||||
|
BufferParams const & bparams)
|
||||||
{
|
{
|
||||||
boost::crc_32_type crc;
|
boost::crc_32_type crc;
|
||||||
for (pos_type i = row.pos(); i < row.endpos(); ++i) {
|
for (pos_type i = row.pos(); i < row.endpos(); ++i) {
|
||||||
char_type const b[] = { par_->getChar(i) };
|
char_type const b[] = { par_->getChar(i) };
|
||||||
crc.process_bytes(b, 1);
|
crc.process_bytes(b, 1);
|
||||||
|
if (bparams.trackChanges) {
|
||||||
|
Change change = par_->lookupChange(i);
|
||||||
|
char_type const b[] = { change.type };
|
||||||
|
crc.process_bytes(b, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return crc.checksum();
|
return crc.checksum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ParagraphMetrics::updateRowChangeStatus()
|
void ParagraphMetrics::updateRowChangeStatus(BufferParams const & bparams)
|
||||||
{
|
{
|
||||||
size_t const size = rows_.size();
|
size_t const size = rows_.size();
|
||||||
row_change_status_.resize(size);
|
row_change_status_.resize(size);
|
||||||
@ -113,7 +119,7 @@ void ParagraphMetrics::updateRowChangeStatus()
|
|||||||
|
|
||||||
for (size_t i = 0; i != size; ++i) {
|
for (size_t i = 0; i != size; ++i) {
|
||||||
// Row signature; has row changed since last update?
|
// Row signature; has row changed since last update?
|
||||||
size_type const row_sig = calculateRowSignature(rows_[i]);
|
size_type const row_sig = calculateRowSignature(rows_[i], bparams);
|
||||||
row_change_status_[i] = row_signature_[i] != row_sig;
|
row_change_status_[i] = row_signature_[i] != row_sig;
|
||||||
row_signature_[i] = row_sig;
|
row_signature_[i] = row_sig;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public:
|
|||||||
std::vector<bool> const & rowChangeStatus() const
|
std::vector<bool> const & rowChangeStatus() const
|
||||||
{ return row_change_status_; }
|
{ return row_change_status_; }
|
||||||
///
|
///
|
||||||
void updateRowChangeStatus();
|
void updateRowChangeStatus(BufferParams const & bparams);
|
||||||
///
|
///
|
||||||
int rightMargin(Buffer const & buffer) const;
|
int rightMargin(Buffer const & buffer) const;
|
||||||
///
|
///
|
||||||
@ -86,7 +86,7 @@ private:
|
|||||||
///
|
///
|
||||||
typedef std::vector<size_type> RowSignature;
|
typedef std::vector<size_type> RowSignature;
|
||||||
///
|
///
|
||||||
size_type calculateRowSignature(Row const &);
|
size_type calculateRowSignature(Row const &, BufferParams const & bparams);
|
||||||
///
|
///
|
||||||
mutable RowList rows_;
|
mutable RowList rows_;
|
||||||
///
|
///
|
||||||
|
@ -268,7 +268,7 @@ bool TextMetrics::redoParagraph(pit_type const pit)
|
|||||||
|
|
||||||
// Update the row change statuses. The painter will need that info
|
// Update the row change statuses. The painter will need that info
|
||||||
// in order to know which row has to be repainted.
|
// in order to know which row has to be repainted.
|
||||||
pm.updateRowChangeStatus();
|
pm.updateRowChangeStatus(bv_->buffer().params());
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user