]> git.lyx.org Git - lyx.git/commitdiff
Fixed various bugs + John's form paragraph bug.
authorJürgen Vigna <jug@sad.it>
Thu, 29 Nov 2001 12:58:59 +0000 (12:58 +0000)
committerJürgen Vigna <jug@sad.it>
Thu, 29 Nov 2001 12:58:59 +0000 (12:58 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3111 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView2.C
src/ChangeLog
src/debug.C
src/insets/ChangeLog
src/insets/insettabular.C
src/insets/insettext.C
src/lyxtext.h
src/text2.C

index c1bfcb34d3f06cbe33440672d9dabfdf7e7f2923..0d5d4c10a418bd6a90f4c40242f5a36808a80994 100644 (file)
@@ -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;
index 8536971afa4a5c4778c3bb6df6731ebbf83dc6ce..4a750b28874541673102a960f43aa5130af562b6 100644 (file)
@@ -1,3 +1,13 @@
+2001-11-29  Juergen Vigna  <jug@sad.it>
+
+       * 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  <jug@sad.it>
 
        * sp_spell.C (initialize): changed error text to more general
index 321700a67fbbadbd13ce8ce6e9a1ebb9af48d013..d2232904cd79f74af6d5b22c5f5ccc68961f7a75 100644 (file)
@@ -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")}
 };
 
 
index 3e17100be12f135bc3ba2a2e186bbd86f6bd0efc..8536c60f2669ce81591389fa183ca3f06da89b51 100644 (file)
@@ -1,3 +1,8 @@
+2001-11-29  Juergen Vigna  <jug@sad.it>
+
+       * insettext.C: inserted a reinitLyXText function everywhere I delete
+       the paragraphs! This should fixe the crashes we had.
+
 2001-11-28  André Pönitz <poenitz@gmx.net>
 
        * insetnote.C: add pos initialization that I removed without
@@ -5,6 +10,8 @@
 
 2001-11-28  Juergen Vigna  <jug@sad.it>
 
+       * 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!
index b81559b7077fb449b0821ea7100e67303f375ef0..1b4f42bd10af6e98de7c6e8722e0a4a87ea44d02 100644 (file)
@@ -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;
index 536601011bec26653d4e6113a26c364c5f4bcf5b..e1737edafd50afda2e0d25345583e7a6ecb5fbec 100644 (file)
@@ -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<BufferView *>(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;
 }
index 1701d75811c7bc8360eae0eafccdd19dcdc98c2c..601f7960f1a8562e8f1446ea89e0e5dba1ad04d5 100644 (file)
@@ -501,9 +501,10 @@ public:
                return bidi_start == -1 ||
                        (bidi_start <= pos && pos <= bidi_end);
        }
-private:
+public:
        ///
        mutable Row * firstrow;
+private:
        ///
        mutable Row * lastrow;
 
index abde4bd529207e3c2cd400747384331c7b8eab12..1440f91c561c231dfe5469c97ac90dd470d44efa 100644 (file)
@@ -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;