From 9a1425adcbdde6bec3108008d2ea6b968a2dc2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Vigna?= Date: Mon, 30 Oct 2000 12:03:18 +0000 Subject: [PATCH] Fixed jumping mathed cursor in text-insets. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1173 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 8 ++++++++ src/BufferView2.C | 8 +++++--- src/insets/insettext.C | 8 +++----- src/lyxfunc.C | 15 ++++++++------- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 911247c86a..e4e823ee2f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-10-30 Juergen Vigna + + * src/insets/insettext.C (InsertInset): fixed this as the cursor + has to be Left of the inset otherwise LyXText won't find it! + + * src/BufferView2.C (open_new_inset): delete the inset if it can + not be inserted. + 2000-10-30 Rob Lahaye * lyx.man: fix typo. diff --git a/src/BufferView2.C b/src/BufferView2.C index a4d3325fb0..5fe3075ef1 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -264,10 +264,12 @@ bool BufferView::open_new_inset(UpdatableInset * new_inset) { beforeChange(); text->FinishUndo(); - if (!insertInset(new_inset)) + if (!insertInset(new_inset)) { + delete new_inset; return false; - text->CursorLeft(this); - update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); + } +// text->CursorLeft(this); +// update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); new_inset->Edit(this, 0, 0, 0); return true; } diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 0dc00b5668..a114219575 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -1266,16 +1266,14 @@ bool InsetText::InsertInset(BufferView * bv, Inset * inset) bv->text->cursor.par()->next #endif ); - if (inset->Editable() == Inset::IS_EDITABLE) { - UpdatableInset * i = static_cast(inset); - i->setOwner(static_cast(this)); - } + inset->setOwner(this); HideInsetCursor(bv); TEXT(bv)->InsertInset(bv, inset); TEXT(bv)->selection = 0; + TEXT(bv)->CursorLeft(bv); bv->fitCursor(TEXT(bv)); UpdateLocal(bv, CURSOR_PAR, true); - static_cast(inset)->Edit(bv, 0, 0, 0); +// inset->Edit(bv, 0, 0, 0); ShowInsetCursor(bv); return true; } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 2398c8cf7c..5bc2838f29 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -2585,13 +2585,14 @@ string const LyXFunc::Dispatch(int ac, case LFUN_INSERT_MATRIX: { if (owner->view()->available()) { - owner->view()-> - open_new_inset(new InsetFormula(false)); - owner->view() - ->theLockingInset() - ->LocalDispatch(owner->view(), - action, - argument); + if (owner->view()-> + open_new_inset(new InsetFormula(false))) + { + owner->view()->theLockingInset() + ->LocalDispatch(owner->view(), + action, + argument); + } } } break;