From: Martin Vermeer Date: Mon, 19 Dec 2005 12:30:34 +0000 (+0000) Subject: Force update on paragraph merge X-Git-Tag: 1.6.10~13738 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=5846f513322f4ddccd3f9989cb284a1013e876e6;p=features.git Force update on paragraph merge git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10673 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 16c1189f83..6313170c48 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2005-12-19 Martin Vermeer + + * lyxtext.h: + * text.C: + * text3.C (Delete, backspace): force update when merging paragraphs + 2005-12-16 Jean-Marc Lasgouttes * BufferView.C (mouseSetCursor): clear the selection properly (bug diff --git a/src/lyxtext.h b/src/lyxtext.h index 4803698437..535d7623de 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -221,9 +221,9 @@ public: /// void cursorBottom(LCursor & cur); /// - void Delete(LCursor & cur); + bool Delete(LCursor & cur); /// - void backspace(LCursor & cur); + bool backspace(LCursor & cur); /// bool selectWordWhenUnderCursor(LCursor & cur, lyx::word_location); /// diff --git a/src/text.C b/src/text.C index f19a06144c..0dbaa9dd7e 100644 --- a/src/text.C +++ b/src/text.C @@ -1534,31 +1534,34 @@ void LyXText::changeCase(LCursor & cur, LyXText::TextCase action) } -void LyXText::Delete(LCursor & cur) +bool LyXText::Delete(LCursor & cur) { BOOST_ASSERT(this == cur.text()); + bool needsUpdate = false; if (cur.pos() != cur.lastpos()) { recordUndo(cur, Undo::DELETE, cur.pit()); setCursorIntern(cur, cur.pit(), cur.pos() + 1, false, cur.boundary()); - backspace(cur); + needsUpdate = 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); + needsUpdate = backspace(cur); } else { setCursorIntern(scur, scur.pit(), scur.pos(), false, scur.boundary()); } } + return needsUpdate; } -void LyXText::backspace(LCursor & cur) +bool LyXText::backspace(LCursor & cur) { BOOST_ASSERT(this == cur.text()); + bool needsUpdate = false; if (cur.pos() == 0) { // The cursor is at the beginning of a paragraph, so // the the backspace will collapse two paragraphs into @@ -1567,7 +1570,7 @@ void LyXText::backspace(LCursor & cur) // but it's not allowed unless it's new Paragraph & par = cur.paragraph(); if (par.isChangeEdited(0, par.size())) - return; + return false; // we may paste some paragraphs @@ -1592,7 +1595,7 @@ void LyXText::backspace(LCursor & cur) } cursorLeft(cur); - return; + return true; } } @@ -1626,6 +1629,7 @@ void LyXText::backspace(LCursor & cur) || pars_[tmppit].layout() == tclass.defaultLayout())) { mergeParagraph(bufparams, pars_, cpit); + needsUpdate = true; if (cur.pos() != 0 && pars_[cpit].isSeparator(cur.pos() - 1)) --cur.pos(); @@ -1651,6 +1655,8 @@ void LyXText::backspace(LCursor & cur) setCurrentFont(cur); setCursor(cur, cur.pit(), cur.pos(), false, cur.boundary()); + + return needsUpdate; } diff --git a/src/text3.C b/src/text3.C index 8a882e22fa..8ac5424993 100644 --- a/src/text3.C +++ b/src/text3.C @@ -621,7 +621,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) case LFUN_DELETE: if (!cur.selection()) { - Delete(cur); + needsUpdate = Delete(cur); cur.resetAnchor(); // It is possible to make it a lot faster still // just comment out the line below... @@ -649,7 +649,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) case LFUN_BACKSPACE: if (!cur.selection()) { if (bv->owner()->getIntl().getTransManager().backspace()) { - backspace(cur); + needsUpdate = backspace(cur); cur.resetAnchor(); // It is possible to make it a lot faster still // just comment out the line below...