]> git.lyx.org Git - lyx.git/commitdiff
Some more fixes.
authorJürgen Vigna <jug@sad.it>
Fri, 10 Aug 2001 12:21:42 +0000 (12:21 +0000)
committerJürgen Vigna <jug@sad.it>
Fri, 10 Aug 2001 12:21:42 +0000 (12:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2482 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insettabular.C
src/insets/insettext.C
src/insets/insettext.h

index c58742ac984daa33e85e9e6442a04ceac11ab5ae..99385c50a2629e92ad34acdf5ee7e000761b6a12 100644 (file)
@@ -1,7 +1,11 @@
 2001-08-10  Juergen Vigna  <jug@sad.it>
 
+       * insettext.C (saveLyXTextState): check for invalid cursor-par.
+       (reinitLyXText): remove wrong_cursor bool as not needed anymore!
+
        * insettabular.C (calculate_dimensions_of_cells): let's try to call
        update only for fixed with cells.
+       (resetPos): try to fix the lockup on spellchecking or s&r.
 
        * insettext.C (update): comment this out as it seems first wrong
        and second not needed anymore!
index d0ee23b7c156eee2b5463a8510ee31c7920e31ce..b750e139de71b84e91cca9da90b12013b0da14e7 100644 (file)
@@ -1323,7 +1323,7 @@ int InsetTabular::getCellXPos(int cell) const
 
 void InsetTabular::resetPos(BufferView * bv) const
 {
-       if (!locked)
+       if (!locked || nodraw())
                return;
        actcol = tabular->column_of_cell(actcell);
 
index b9eee979eefa2d8b4851613cd7bcd6775b168e42..1f747d11aac19c3c9461b01c85cacabd6b7a4ee1 100644 (file)
@@ -69,18 +69,30 @@ extern int greek_kb_flag;
 
 void InsetText::saveLyXTextState(LyXText * t) const
 {
-       sstate.lpar = t->cursor.par();
-       sstate.pos = t->cursor.pos();
-       sstate.boundary = t->cursor.boundary();
-       sstate.selstartpar = t->selection.start.par();
-       sstate.selstartpos = t->selection.start.pos();
-       sstate.selstartboundary = t->selection.start.boundary();
-       sstate.selendpar = t->selection.end.par();
-       sstate.selendpos = t->selection.end.pos();
-       sstate.selendboundary = t->selection.end.boundary();
-       sstate.selection = t->selection.set();
-       sstate.mark_set = t->selection.mark();
-       sstate.refresh = t->refresh_row != 0;
+       // check if my paragraphs are still valid
+       Paragraph * p = par;
+       while(p) {
+               if (p == t->cursor.par())
+                       break;
+               p = p->next();
+       }
+       
+       if (p && t->cursor.pos() <= p->size()) {
+               sstate.lpar = t->cursor.par();
+               sstate.pos = t->cursor.pos();
+               sstate.boundary = t->cursor.boundary();
+               sstate.selstartpar = t->selection.start.par();
+               sstate.selstartpos = t->selection.start.pos();
+               sstate.selstartboundary = t->selection.start.boundary();
+               sstate.selendpar = t->selection.end.par();
+               sstate.selendpos = t->selection.end.pos();
+               sstate.selendboundary = t->selection.end.boundary();
+               sstate.selection = t->selection.set();
+               sstate.mark_set = t->selection.mark();
+               sstate.refresh = t->refresh_row != 0;
+       } else {
+               sstate.lpar = 0;
+       }
 }
 
 void InsetText::restoreLyXTextState(BufferView * bv, LyXText * t) const
@@ -1942,7 +1954,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
 }
 
 
-void InsetText::reinitLyXText(bool wrong_cursor) const
+void InsetText::reinitLyXText() const
 {
 //     lyxerr << "InsetText::reinitLyXText\n";
        for(Cache::iterator it = cache.begin(); it != cache.end(); ++it) {
@@ -1951,11 +1963,6 @@ void InsetText::reinitLyXText(bool wrong_cursor) const
                LyXText * t = it->second.text.get();
                BufferView * bv = it->first;
 
-               if (wrong_cursor) {
-                       t->cursor.par(par);
-                       t->cursor.pos(0);
-                       t->clearSelection();
-               }
                saveLyXTextState(t);
                for (Paragraph * p = par; p; p = p->next()) {
                        p->resizeInsetsLyXText(bv);
index fb9898c18af4d38710a38819a4258eb40396df38..e340437e9e39b66456acdef2bf98bef87c5f9725 100644 (file)
@@ -320,7 +320,7 @@ private:
        void saveLyXTextState(LyXText *) const;
        void restoreLyXTextState(BufferView *, LyXText *) const;
        ///
-       void reinitLyXText(bool wrong_cursor = false) const;
+       void reinitLyXText() const;
        
        /* Private structures and variables */
        ///