mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
* src/paragraph.C:
* src/paragraph.h: * src/paragraph_pimpl.C: * src/paragraph_pimpl.h: add method isMergedOnEndOfParDeletion() git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16029 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5524f5f857
commit
62ef9250a2
@ -1421,6 +1421,12 @@ bool Paragraph::isChanged(pos_type start, pos_type end) const
|
||||
}
|
||||
|
||||
|
||||
bool Paragraph::isMergedOnEndOfParDeletion(bool trackChanges) const
|
||||
{
|
||||
return pimpl_->isMergedOnEndOfParDeletion(trackChanges);
|
||||
}
|
||||
|
||||
|
||||
void Paragraph::setChange(Change const & change)
|
||||
{
|
||||
pimpl_->setChange(change);
|
||||
|
@ -209,6 +209,10 @@ public:
|
||||
return lookupChange(pos).type == Change::DELETED;
|
||||
}
|
||||
|
||||
/// will the paragraph be physically merged with the next
|
||||
/// one if the imaginary end-of-par character is logically deleted?
|
||||
bool isMergedOnEndOfParDeletion(bool trackChanges) const;
|
||||
|
||||
/// set change for the entire par
|
||||
void setChange(Change const & change);
|
||||
|
||||
|
@ -87,6 +87,19 @@ bool Paragraph::Pimpl::isChanged(pos_type start, pos_type end) const
|
||||
}
|
||||
|
||||
|
||||
bool Paragraph::Pimpl::isMergedOnEndOfParDeletion(bool trackChanges) const {
|
||||
// keep the logic here in sync with the logic of eraseChars()
|
||||
|
||||
if (!trackChanges) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Change change = changes_.lookup(size());
|
||||
|
||||
return change.type == Change::INSERTED && change.author == 0;
|
||||
}
|
||||
|
||||
|
||||
void Paragraph::Pimpl::setChange(Change const & change)
|
||||
{
|
||||
// beware of the imaginary end-of-par character!
|
||||
@ -263,6 +276,8 @@ bool Paragraph::Pimpl::eraseChar(pos_type pos, bool trackChanges)
|
||||
{
|
||||
BOOST_ASSERT(pos >= 0 && pos <= size());
|
||||
|
||||
// keep the logic here in sync with the logic of isMergedOnEndOfParDeletion()
|
||||
|
||||
if (trackChanges) {
|
||||
Change change = changes_.lookup(pos);
|
||||
|
||||
|
@ -43,8 +43,11 @@ public:
|
||||
Change const lookupChange(pos_type pos) const;
|
||||
/// is there a change within the given range ?
|
||||
bool isChanged(pos_type start, pos_type end) const;
|
||||
/// set change for the entire par
|
||||
void setChange(Change const & change);
|
||||
/// will the paragraph be physically merged with the next
|
||||
/// one if the imaginary end-of-par character is logically deleted?
|
||||
bool isMergedOnEndOfParDeletion(bool trackChanges) const;
|
||||
/// set change for the entire par
|
||||
void setChange(Change const & change);
|
||||
/// set change at given pos
|
||||
void setChange(pos_type pos, Change const & change);
|
||||
/// accept changes within the given range
|
||||
|
Loading…
Reference in New Issue
Block a user