From 9f3dd22dd39c419522914846b21dd2b45720ad0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Vigna?= Date: Mon, 13 Aug 2001 11:27:53 +0000 Subject: [PATCH] Fixed S&R functions with insets. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2497 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 2 ++ src/insets/ChangeLog | 4 ++++ src/insets/insetcollapsable.C | 4 +++- src/insets/insettext.C | 6 ++++-- src/lyxfind.C | 5 ++++- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b52f7c6ca8..7538ed4050 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,8 @@ * lyxfind.C (LyXReplace): fixed not single-replacing characters with casesensitive off. + (SearchBackward): comment out the unlocking of the inset_owner this + should not be needed! 2001-08-11 Dekel Tsur diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 3f8f4a0cf0..2a6e14a9bf 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,8 +1,12 @@ 2001-08-13 Juergen Vigna + * insetcollapsable.C (edit): don't recollapse an already open inset. + * insettext.C: fixed problem when reinitializing LyXText by not doing it while lt is in use and post this to the next possible time in getLyXText(). + (searchForward): fixed not unlocking of inset if nothing found. + (edit): set cursor behind right (was set -1 pos). * insetert.C (InsetERT): init status_ also in the 3rd constructor. diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index b5c7cb0212..ce43acc582 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -238,6 +238,9 @@ void InsetCollapsable::edit(BufferView * bv, int xp, int yp, if (collapsed_) { collapsed_ = false; + // set this only here as it should be recollapsed only if + // it was already collapsed! + first_after_edit = true; if (!bv->lockInset(this)) return; bv->updateInset(this, true); @@ -256,7 +259,6 @@ void InsetCollapsable::edit(BufferView * bv, int xp, int yp, inset.edit(bv, xp, yy, button); } } - first_after_edit = true; } diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 4c677b4ce1..09a29c4a85 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -708,8 +708,8 @@ void InsetText::edit(BufferView * bv, bool front) Paragraph * p = par; while(p->next()) p = p->next(); - int const pos = (p->size() ? p->size()-1 : p->size()); - lt->setCursor(bv, p, pos); +// int const pos = (p->size() ? p->size()-1 : p->size()); + lt->setCursor(bv, p, p->size()); } lt->clearSelection(); finishUndo(); @@ -2272,6 +2272,8 @@ bool InsetText::searchForward(BufferView * bv, string const & str, if (!lpar) { if (clear) lt = 0; + // we have to unlock ourself in this function by default! + bv->unlockInset(const_cast(this)); return false; } lt->setCursor(bv, lpar, pos); diff --git a/src/lyxfind.C b/src/lyxfind.C index 34d1bfaebe..03de70a469 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -311,7 +311,9 @@ SearchResult SearchBackward(BufferView * bv, LyXText * text, if (par) { text->setCursor(bv, par, pos); return SR_FOUND; - } else if (text->inset_owner) { + } +#if 0 + else if (text->inset_owner) { // test if we're inside an inset if yes unlock the inset // and recall us with the outside LyXText! bv->unlockInset((UpdatableInset *)text->inset_owner); @@ -319,6 +321,7 @@ SearchResult SearchBackward(BufferView * bv, LyXText * text, return SearchBackward(bv, bv->getLyXText(), str, cs, mw); } } +#endif return SR_NOT_FOUND; }