mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-23 08:44:01 +00:00
* src/CutAndPaste.C:
* src/paragraph.C: * src/paragraph.h: * src/text2.C: consider change tracking in stripLeadingSpaces() git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16684 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9c09f34da0
commit
ee5aa68acf
@ -270,7 +270,7 @@ pasteSelectionHelper(LCursor & cur, ParagraphList const & parlist,
|
||||
pars[last_paste].makeSameLayout(pars[last_paste + 1]);
|
||||
mergeParagraph(buffer.params(), pars, last_paste);
|
||||
} else {
|
||||
pars[last_paste + 1].stripLeadingSpaces();
|
||||
pars[last_paste + 1].stripLeadingSpaces(buffer.params().trackChanges);
|
||||
++last_paste;
|
||||
}
|
||||
}
|
||||
@ -309,7 +309,7 @@ PitPosPair eraseSelectionHelper(BufferParams const & params,
|
||||
(pit + 1 != endpit || pars[pit].hasSameLayout(pars[pit + 1]))) {
|
||||
pos_type const thissize = pars[pit].size();
|
||||
if (doclear)
|
||||
pars[pit + 1].stripLeadingSpaces();
|
||||
pars[pit + 1].stripLeadingSpaces(params.trackChanges);
|
||||
mergeParagraph(params, pars, pit);
|
||||
--endpit;
|
||||
if (pit == endpit)
|
||||
@ -539,7 +539,7 @@ void cutSelection(LCursor & cur, bool doclear, bool realcut)
|
||||
|
||||
// sometimes necessary
|
||||
if (doclear)
|
||||
text->paragraphs()[begpit].stripLeadingSpaces();
|
||||
text->paragraphs()[begpit].stripLeadingSpaces(bp.trackChanges);
|
||||
|
||||
// cutSelection can invalidate the cursor so we need to set
|
||||
// it anew. (Lgb)
|
||||
|
@ -560,19 +560,22 @@ void Paragraph::makeSameLayout(Paragraph const & par)
|
||||
}
|
||||
|
||||
|
||||
int Paragraph::stripLeadingSpaces()
|
||||
int Paragraph::stripLeadingSpaces(bool trackChanges)
|
||||
{
|
||||
if (isFreeSpacing())
|
||||
return 0;
|
||||
|
||||
int i = 0;
|
||||
while (!empty() && (isNewline(0) || isLineSeparator(0))
|
||||
&& !isDeleted(0)) {
|
||||
eraseChar(0, false); // no change tracking here
|
||||
++i;
|
||||
int pos = 0;
|
||||
int count = 0;
|
||||
|
||||
while (pos < size() && (isNewline(pos) || isLineSeparator(pos))) {
|
||||
if (eraseChar(pos, trackChanges))
|
||||
++count;
|
||||
else
|
||||
++pos;
|
||||
}
|
||||
|
||||
return i;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
@ -346,7 +346,7 @@ public:
|
||||
int getPositionOfInset(InsetBase const * inset) const;
|
||||
|
||||
/// Returns the number of line breaks and white-space stripped at the start
|
||||
int stripLeadingSpaces();
|
||||
int stripLeadingSpaces(bool trackChanges);
|
||||
|
||||
/// return true if we allow multiple spaces
|
||||
bool isFreeSpacing() const;
|
||||
|
@ -1231,7 +1231,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (oldpar.stripLeadingSpaces())
|
||||
if (oldpar.stripLeadingSpaces(cur.buffer().params().trackChanges))
|
||||
need_anchor_change = true;
|
||||
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user