bug 575: allow merging of paragraphs by Delete/Backspace with the same Layout

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10294 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2005-07-17 16:12:48 +00:00
parent c888a3578e
commit 2f8967b43b
2 changed files with 19 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2005-07-17 Juergen Vigna <jug@lyx.org>
* text.C (Delete, backspace): fixed so that paragraph with the
same layout can be merged by Delete/Backspace.
2005-07-17 Michael Schmitt <michael.schmitt@teststep.org> 2005-07-17 Michael Schmitt <michael.schmitt@teststep.org>
* text.C (readParToken): fix spelling. * text.C (readParToken): fix spelling.

View File

@ -1549,12 +1549,22 @@ void LyXText::changeCase(LCursor & cur, LyXText::TextCase action)
void LyXText::Delete(LCursor & cur) void LyXText::Delete(LCursor & cur)
{ {
BOOST_ASSERT(this == cur.text()); BOOST_ASSERT(this == cur.text());
if (cur.pos() != cur.lastpos()) { if (cur.pos() != cur.lastpos()) {
recordUndo(cur, Undo::DELETE, cur.pit()); recordUndo(cur, Undo::DELETE, cur.pit());
setCursorIntern(cur, cur.pit(), cur.pos() + 1, false, cur.boundary()); setCursorIntern(cur, cur.pit(), cur.pos() + 1, false, cur.boundary());
backspace(cur); backspace(cur);
} else if (cur.pit() != cur.lastpit()) {
LCursor scur = cur;
setCursorIntern(cur, cur.pit()+1, 0, false, false);
if (pars_[cur.pit()].layout() == pars_[scur.pit()].layout()) {
recordUndo(scur, Undo::DELETE, scur.pit());
backspace(cur);
} else {
setCursorIntern(scur, scur.pit(), scur.pos(), false, scur.boundary());
}
} }
// should we do anything in an else branch?
} }
@ -1617,6 +1627,7 @@ void LyXText::backspace(LCursor & cur)
// layout. I think it is a real bug of all other // layout. I think it is a real bug of all other
// word processors to allow it. It confuses the user. // word processors to allow it. It confuses the user.
// Correction: Pasting is always allowed with standard-layout // Correction: Pasting is always allowed with standard-layout
// Correction (Jug 20050717): Remove check about alignment!
Buffer & buf = cur.buffer(); Buffer & buf = cur.buffer();
BufferParams const & bufparams = buf.params(); BufferParams const & bufparams = buf.params();
LyXTextClass const & tclass = bufparams.getLyXTextClass(); LyXTextClass const & tclass = bufparams.getLyXTextClass();
@ -1624,8 +1635,8 @@ void LyXText::backspace(LCursor & cur)
if (cpit != tmppit if (cpit != tmppit
&& (pars_[cpit].layout() == pars_[tmppit].layout() && (pars_[cpit].layout() == pars_[tmppit].layout()
|| pars_[tmppit].layout() == tclass.defaultLayout()) || pars_[tmppit].layout() == tclass.defaultLayout()))
&& pars_[cpit].getAlign() == pars_[tmppit].getAlign()) { {
mergeParagraph(bufparams, pars_, cpit); mergeParagraph(bufparams, pars_, cpit);
if (cur.pos() != 0 && pars_[cpit].isSeparator(cur.pos() - 1)) if (cur.pos() != 0 && pars_[cpit].isSeparator(cur.pos() - 1))