mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
solve Bug 3600 by eliminating a call to stripLeadingSpaces
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19911 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3ee543a64e
commit
80df00006c
@ -288,7 +288,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
|
||||
PitPosPair eraseSelectionHelper(BufferParams const & params,
|
||||
ParagraphList & pars,
|
||||
pit_type startpit, pit_type endpit,
|
||||
int startpos, int endpos, bool doclear)
|
||||
int startpos, int endpos)
|
||||
{
|
||||
// Start of selection is really invalid.
|
||||
if (startpit == pit_type(pars.size()) ||
|
||||
@ -304,12 +304,6 @@ PitPosPair eraseSelectionHelper(BufferParams const & params,
|
||||
for (pit_type pit = startpit; pit != endpit + 1;) {
|
||||
pos_type const left = (pit == startpit ? startpos : 0);
|
||||
pos_type right = (pit == endpit ? endpos : pars[pit].size() + 1);
|
||||
// FIXME: this is a quick fix for bug 3600. It stops a crash but the problem
|
||||
// still remains unsolved (e.g. the second example in the bug report).
|
||||
// c.f. http://bugzilla.lyx.org/show_bug.cgi?id=3600
|
||||
if (right > pars[pit].size() + 1)
|
||||
right = pars[pit].size() + 1;
|
||||
|
||||
bool const merge = pars[pit].isMergedOnEndOfParDeletion(params.trackChanges);
|
||||
|
||||
// Logically erase only, including the end-of-paragraph character
|
||||
@ -317,14 +311,11 @@ PitPosPair eraseSelectionHelper(BufferParams const & params,
|
||||
|
||||
// Separate handling of paragraph break:
|
||||
if (merge && pit != endpit &&
|
||||
(pit + 1 != endpit || pars[pit].hasSameLayout(pars[pit + 1]))) {
|
||||
pos_type const thissize = pars[pit].size();
|
||||
if (doclear)
|
||||
pars[pit + 1].stripLeadingSpaces(params.trackChanges);
|
||||
(pit + 1 != endpit || pars[pit].hasSameLayout(pars[endpit]))) {
|
||||
if (pit + 1 == endpit)
|
||||
endpos += pars[pit].size();
|
||||
mergeParagraph(params, pars, pit);
|
||||
--endpit;
|
||||
if (pit == endpit)
|
||||
endpos += thissize;
|
||||
} else
|
||||
++pit;
|
||||
}
|
||||
@ -550,8 +541,7 @@ void cutSelection(Cursor & cur, bool doclear, bool realcut)
|
||||
eraseSelectionHelper(bp,
|
||||
text->paragraphs(),
|
||||
begpit, endpit,
|
||||
cur.selBegin().pos(), endpos,
|
||||
doclear);
|
||||
cur.selBegin().pos(), endpos);
|
||||
|
||||
// cutSelection can invalidate the cursor so we need to set
|
||||
// it anew. (Lgb)
|
||||
|
Loading…
Reference in New Issue
Block a user