fix bug 3600

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@19942 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2007-08-31 10:45:51 +00:00
parent c51c8a7257
commit f3b55ec4e7
2 changed files with 7 additions and 15 deletions

View File

@ -287,7 +287,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()) ||
@ -303,12 +303,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
@ -316,14 +310,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;
}
@ -553,8 +544,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)

View File

@ -116,6 +116,8 @@ What's new
- Highlight search text (bug 3999).
- Fix deletion of pars with leading spaces (bug 3600).
* DOCUMENTATION