From 08b1fdacad52474c2aceb6e5ff354e8e870ddc47 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Vigna?= Date: Thu, 29 Nov 2001 12:58:59 +0000 Subject: [PATCH] Fixed various bugs + John's form paragraph bug. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3111 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView2.C | 3 +++ src/ChangeLog | 10 ++++++++++ src/debug.C | 3 ++- src/insets/ChangeLog | 7 +++++++ src/insets/insettabular.C | 1 + src/insets/insettext.C | 16 ++++++++-------- src/lyxtext.h | 3 ++- src/text2.C | 5 +++++ 8 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/BufferView2.C b/src/BufferView2.C index c1bfcb34d3..0d5d4c10a4 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -390,6 +390,9 @@ void BufferView::replaceWord(string const & replacestring) bool BufferView::lockInset(UpdatableInset * inset) { + // don't relock if we're already locked + if (theLockingInset() == inset) + return true; if (!theLockingInset() && inset) { theLockingInset(inset); return true; diff --git a/src/ChangeLog b/src/ChangeLog index 8536971afa..4a750b2887 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2001-11-29 Juergen Vigna + + * BufferView2.C (lockInset): don't relock if we're already locked! + + * text2.C (deleteEmptyParagraphMechanism): don't do anything if it's + the only paragraph. + (removeRow): added Assert::(firstrow) + + * debug.C: forgot to add INSETTEXT here. + 2001-11-28 Juergen Vigna * sp_spell.C (initialize): changed error text to more general diff --git a/src/debug.C b/src/debug.C index 321700a67f..d2232904cd 100644 --- a/src/debug.C +++ b/src/debug.C @@ -54,7 +54,8 @@ error_item errorTags[] = { { Debug::INSETS, "insets", N_("LyX Insets")}, { Debug::FILES, "files", N_("Files used by LyX")}, { Debug::WORKAREA, "workarea", N_("Workarea events")}, - { Debug::ANY, "any", N_("All debugging messages")} + { Debug::INSETTEXT, "insettext", N_("Insettext/tabular messanges")}, + { Debug::ANY, "any", N_("All debugging messages")} }; diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 3e17100be1..8536c60f26 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2001-11-29 Juergen Vigna + + * insettext.C: inserted a reinitLyXText function everywhere I delete + the paragraphs! This should fixe the crashes we had. + 2001-11-28 André Pönitz * insetnote.C: add pos initialization that I removed without @@ -5,6 +10,8 @@ 2001-11-28 Juergen Vigna + * insettabular.C (resetPos): hack to not crash with infinite paints. + * insettabular.h: insert missing function allowSpellcheck()! * insetcollapsable.C (draw): fixed wrong width of collapsed inset! diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index b81559b707..1b4f42bd10 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -1352,6 +1352,7 @@ void InsetTabular::resetPos(BufferView * bv) const { if (!locked || nodraw()) return; +#warning This should be fixed in the right manner (20011128 Jug) // fast hack to fix infinite repaintings! if (in_reset_pos) return; diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 536601011b..e1737edafd 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -219,6 +219,7 @@ void InsetText::clear() par = tmp; } par = new Paragraph; + reinitLyXText(); need_update = INIT; } @@ -545,6 +546,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit) in_update = true; if (reinit || need_update == INIT) { need_update = FULL; + // we should put this call where we set need_update to INIT! reinitLyXText(); if (owner()) owner()->update(bv, font, true); @@ -1938,6 +1940,7 @@ void InsetText::setParagraphData(Paragraph * p) np = np->next(); np->setInsetOwner(this); } + reinitLyXText(); need_update = INIT; } @@ -2037,8 +2040,11 @@ Row * InsetText::crow(BufferView * bv) const LyXText * InsetText::getLyXText(BufferView const * lbv, bool const recursive) const { - if (!recursive && (cached_bview == lbv)) + if (!recursive && (cached_bview == lbv)) { + LyXText * lt = cached_text.get(); + lyx::Assert(lt && lt->firstrow->par() == par); return cached_text.get(); + } // Super UGLY! (Lgb) BufferView * bv = const_cast(lbv); @@ -2327,13 +2333,7 @@ Paragraph * InsetText::paragraph() const void InsetText::paragraph(Paragraph * p) { par = p; -#if 0 - // we now have to update/redraw all instances - for (Cache::iterator cit = cache.begin(); cit != cache.end(); ++cit) { - delete cit->second; - cit->second = 0; - } -#endif + reinitLyXText(); // redraw myself when asked for need_update = INIT; } diff --git a/src/lyxtext.h b/src/lyxtext.h index 1701d75811..601f7960f1 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -501,9 +501,10 @@ public: return bidi_start == -1 || (bidi_start <= pos && pos <= bidi_end); } -private: +public: /// mutable Row * firstrow; +private: /// mutable Row * lastrow; diff --git a/src/text2.C b/src/text2.C index abde4bd529..1440f91c56 100644 --- a/src/text2.C +++ b/src/text2.C @@ -391,6 +391,7 @@ void LyXText::removeRow(Row * row) const row->next()->previous(row->previous()); if (!row->previous()) { firstrow = row->next(); + lyx::Assert(firstrow); } else { row->previous()->next(row->next()); } @@ -2366,6 +2367,10 @@ void LyXText::fixCursorAfterDelete(BufferView * bview, void LyXText::deleteEmptyParagraphMechanism(BufferView * bview, LyXCursor const & old_cursor) const { + // don't delete anything if this is the ONLY paragraph! + if (!old_cursor.par()->next() && !old_cursor.par()->previous()) + return; + // Would be wrong to delete anything if we have a selection. if (selection.set()) return; -- 2.39.2