From 8466aa353b0deffdd302ccea734c901a07d9e382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Vigna?= Date: Fri, 10 Aug 2001 12:21:42 +0000 Subject: [PATCH] Some more fixes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2482 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/ChangeLog | 4 ++++ src/insets/insettabular.C | 2 +- src/insets/insettext.C | 43 +++++++++++++++++++++++---------------- src/insets/insettext.h | 2 +- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index c58742ac98..99385c50a2 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,7 +1,11 @@ 2001-08-10 Juergen Vigna + * 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! diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index d0ee23b7c1..b750e139de 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -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); diff --git a/src/insets/insettext.C b/src/insets/insettext.C index b9eee979ee..1f747d11aa 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -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); diff --git a/src/insets/insettext.h b/src/insets/insettext.h index fb9898c18a..e340437e9e 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -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 */ ///