]> git.lyx.org Git - features.git/commitdiff
bug 575: allow merging of paragraphs by Delete/Backspace with the same Layout
authorJürgen Vigna <jug@sad.it>
Sun, 17 Jul 2005 16:12:48 +0000 (16:12 +0000)
committerJürgen Vigna <jug@sad.it>
Sun, 17 Jul 2005 16:12:48 +0000 (16:12 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10294 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text.C

index 32ccda9556be63a3547aa5c62719e98a1e948ea8..c364b1591a5109f476d20a144f6d55847af415e4 100644 (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>
 
        * text.C (readParToken): fix spelling.
index b047b618e0667339bbecadd377aa2bc4790cdc73..63b5d4a91d39da501afee280a282d05d0ae4f595 100644 (file)
@@ -1549,12 +1549,22 @@ void LyXText::changeCase(LCursor & cur, LyXText::TextCase action)
 void LyXText::Delete(LCursor & cur)
 {
        BOOST_ASSERT(this == cur.text());
+
        if (cur.pos() != cur.lastpos()) {
                recordUndo(cur, Undo::DELETE, cur.pit());
                setCursorIntern(cur, cur.pit(), cur.pos() + 1, false, cur.boundary());
                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
                // word processors to allow it. It confuses the user.
                // Correction: Pasting is always allowed with standard-layout
+               // Correction (Jug 20050717): Remove check about alignment!
                Buffer & buf = cur.buffer();
                BufferParams const & bufparams = buf.params();
                LyXTextClass const & tclass = bufparams.getLyXTextClass();
@@ -1624,8 +1635,8 @@ void LyXText::backspace(LCursor & cur)
 
                if (cpit != tmppit
                    && (pars_[cpit].layout() == pars_[tmppit].layout()
-                       || pars_[tmppit].layout() == tclass.defaultLayout())
-                   && pars_[cpit].getAlign() == pars_[tmppit].getAlign()) {
+                       || pars_[tmppit].layout() == tclass.defaultLayout()))
+               {
                        mergeParagraph(bufparams, pars_, cpit);
 
                        if (cur.pos() != 0 && pars_[cpit].isSeparator(cur.pos() - 1))