]> git.lyx.org Git - features.git/commitdiff
Losts of fixes to cursor handling with insets. Cursor up/down now can
authorJürgen Vigna <jug@sad.it>
Tue, 16 Apr 2002 14:10:39 +0000 (14:10 +0000)
committerJürgen Vigna <jug@sad.it>
Tue, 16 Apr 2002 14:10:39 +0000 (14:10 +0000)
transverse also inset if they are on it's way, Page up/down for InsetText
fixed (cleanly now as I finally understood the algorithm ;) This fixes some
non reported bugs, some in Michaels list, some reported on the mailing
list and #314 on our buglist.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4008 a592a061-630c-0410-9148-cb99ea01b6c8

14 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/insets/ChangeLog
src/insets/inset.h
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/lyxcursor.C
src/lyxcursor.h
src/lyxfunc.C
src/text2.C

index ee6dde8a4c46006c1e0b3b0903f5c8c30d34874a..1a43fd4abc4050bdf1ec6dd6084f3968a9a4dca5 100644 (file)
@@ -912,13 +912,13 @@ Box BufferView::Pimpl::insetDimensions(LyXText const & text,
 
        int const width = inset.width(bv_, font);
        int const inset_x = font.isVisibleRightToLeft()
-               ? (cursor.x() - width) : cursor.x();
+               ? (cursor.ix() - width) : cursor.ix();
 
        return Box(
                inset_x + inset.scroll(),
                inset_x + width,
-               cursor.y() - inset.ascent(bv_, font),
-               cursor.y() + inset.descent(bv_, font));
+               cursor.iy() - inset.ascent(bv_, font),
+               cursor.iy() + inset.descent(bv_, font));
 }
 
 
@@ -1167,19 +1167,27 @@ void BufferView::Pimpl::cursorPrevious(LyXText * text)
        int y = text->first_y;
        Row * cursorrow = text->cursor.row();
 
-       text->setCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y);
+       text->setCursorFromCoordinates(bv_, text->cursor.x_fix(), y);
        finishUndo();
        // This is to allow jumping over large insets
        if ((cursorrow == text->cursor.row()))
                text->cursorUp(bv_);
 
-       if (text->inset_owner ||
-           text->cursor.row()->height() < workarea_.height())
-               screen_->draw(bv_->text, bv_,
+       if (text->inset_owner) {
+               int new_y = bv_->text->cursor.iy()
+                       + bv_->theLockingInset()->insetInInsetY()
+                       + y
+                       + text->cursor.row()->height()
+                       - workarea_.height() + 1;
+
+               screen_->draw(bv_->text, bv_, new_y < 0 ? 0 : new_y);
+       } else if (text->cursor.row()->height() < workarea_.height()) {
+               screen_->draw(text, bv_,
                              text->cursor.y()
                              - text->cursor.row()->baseline()
                              + text->cursor.row()->height()
                              - workarea_.height() + 1);
+       }
        updateScrollbar();
 }
 
@@ -1190,8 +1198,11 @@ void BufferView::Pimpl::cursorNext(LyXText * text)
                return;
 
        int y = text->first_y + workarea_.height();
-//     if (text->inset_owner)
-//             y += bv_->text->first;
+       if (text->inset_owner && !text->first_y) {
+               y -= (bv_->text->cursor.iy()
+                         - bv_->text->first_y
+                         + bv_->theLockingInset()->insetInInsetY());
+       }
        text->getRowNearY(y);
 
        Row * cursorrow = text->cursor.row();
@@ -1201,10 +1212,15 @@ void BufferView::Pimpl::cursorNext(LyXText * text)
        if ((cursorrow == bv_->text->cursor.row()))
                text->cursorDown(bv_);
 
-       if (text->inset_owner ||
-           text->cursor.row()->height() < workarea_.height())
-               screen_->draw(bv_->text, bv_, text->cursor.y() -
+       if (text->inset_owner) {
+               screen_->draw(bv_->text, bv_,
+                             bv_->text->cursor.iy()
+                                 + bv_->theLockingInset()->insetInInsetY()
+                                 + y - text->cursor.row()->baseline());
+       } else if (text->cursor.row()->height() < workarea_.height()) {
+               screen_->draw(text, bv_, text->cursor.y() -
                              text->cursor.row()->baseline());
+       }
        updateScrollbar();
 }
 
index 033155323c48988526c9b18ae9c7c7f44a6ce620..966b5a71ef6250aca2ac650b51e277f3133ca0fd 100644 (file)
@@ -1,3 +1,24 @@
+2002-04-16  Juergen Vigna  <jug@sad.it>
+
+       * text2.C (setCursor): set also the irow().
+       (setCursorFromCoordinates): fixed to set the (i) cursor values right!
+       (cursorUp):
+       (cursorDown): support for locking an inset if the x_fix value goes
+       inside it. That way I can transverse insets too with cursor up/down.
+
+       * lyxrow.h: added irow helper function same as other (i) functions.
+
+       * BufferView_pimpl.C (cursorPrevious): 
+       (cursorNext): fixed for insets!
+
+2002-04-15  Juergen Vigna  <jug@sad.it>
+
+       * BufferView_pimpl.C (insetDimensions): use ix/iy values for inset
+       position otherwise it is wrong in some cases.
+
+       * lyxfunc.C (dispatch): fix FINISHED UP/DOWN to handle x position
+       inside the inset before the call.
+
 2002-04-16  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * buffer.[Ch] (getBibkeyList): make it const.
index b86eca6d83d413f6c6ddf2a2d1d0147a762a0c32..f110b20fb25abbcaded6cef82ae8cbf153c24ef0 100644 (file)
@@ -1,3 +1,32 @@
+2002-04-16  Juergen Vigna  <jug@sad.it>
+
+       * insettabular.C (insetButtonPress): 
+       (insetUnlock): call a redraw on unlocking the cell inset.
+
+       * insettext.C (insetButtonPress): same as below.
+       (lockInset): new function to set initial values when inset should
+       be locked.
+       (insetButtonPress): use above function.
+       (insetUnlock): don't force a repaint only set the updateStatus. The
+       outside world should repaint if it thinks it should be done!
+
+       * insettabular.C (insetButtonPress): init values if not set as locked
+       as we are locked if someone presses on us and don't call the edit()
+       call of the InsetText to lock it do it as BufferView does it!
+
+       * inset.h (insetInInsetY): make func const and return an int.
+       * insettext.C:
+       * insettabular.C:
+       * insetcollapsable.C: adapt the above changed function.
+
+2002-04-15  Juergen Vigna  <jug@sad.it>
+
+       * insettext.C (getCursorPos): return relative position as to be able
+       to give them directly to the edit() call.
+       (edit): we have to set also x_fix as it is not set inside the
+       setCursorFromCoordinates call!
+       (insetMotionNotify): ditto.
+
 2002-04-16  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * insetbib.C (getKeys): strip leading '\t's from the line too.
index 9b0a4c5149107e14475793919eb618d2eed7a2b8..77c03f19881bebf4e2b62ba32bdcb406c90a5ab2 100644 (file)
@@ -478,7 +478,7 @@ public:
        virtual UpdatableInset * getFirstLockingInsetOfType(Inset::Code c)
                { return (c == lyxCode()) ? this : 0; }
        ///
-       virtual unsigned int insetInInsetY() { return 0; }
+       virtual int insetInInsetY() const { return 0; }
        ///
        virtual bool updateInsetInInset(BufferView *, Inset *)
                { return false; }
index 53e97c3f4204a38023d39ba4dfed43677d9dc15c..ca3defd7c82c0058d6f07e70270b19bc1f5ae019 100644 (file)
@@ -252,7 +252,7 @@ void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
                if (!bv->lockInset(this))
                        return;
                if (yp <= button_bottom_y) {
-                       inset.edit(bv);
+                       inset.edit(bv, xp, 0, button);
                } else {
                        LyXFont font(LyXFont::ALL_SANE);
                        int yy = ascent(bv, font) + yp -
@@ -481,7 +481,7 @@ bool InsetCollapsable::updateInsetInInset(BufferView * bv, Inset *in)
 }
 
 
-unsigned int InsetCollapsable::insetInInsetY()
+int InsetCollapsable::insetInInsetY() const
 {
        return inset.insetInInsetY() - (top_baseline - inset.y());
 }
index d76ff261586695d17ba983d1b4bab1a7e7d1b0a2..e7f496e5f8bd83e4af0dce736c9edc1ad8133e39 100644 (file)
@@ -87,7 +87,7 @@ public:
        ///
        bool updateInsetInInset(BufferView *, Inset *);
        ///
-       unsigned int insetInInsetY();
+       int insetInInsetY() const;
        ///
        bool insetButtonRelease(BufferView *, int, int, int);
        ///
index b4496156bc563170accf8f75e60dc3f75e8be368..3a2d8ece0801dbbaefe5923e50396b33570ce896 100644 (file)
@@ -598,6 +598,7 @@ void InsetTabular::insetUnlock(BufferView * bv)
        if (the_locking_inset) {
                the_locking_inset->insetUnlock(bv);
                the_locking_inset = 0;
+               updateLocal(bv, CELL, false);
        }
        hideInsetCursor(bv);
        oldcell = -1;
@@ -729,7 +730,7 @@ bool InsetTabular::updateInsetInInset(BufferView * bv, Inset * inset)
 }
 
 
-unsigned int InsetTabular::insetInInsetY()
+int InsetTabular::insetInInsetY() const
 {
        if (!the_locking_inset)
                return 0;
@@ -776,6 +777,12 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
        int const orow = actrow;
 
        hideInsetCursor(bv);
+       if (!locked) {
+               locked = true;
+               the_locking_inset = 0;
+               inset_x = 0;
+               inset_y = 0;
+       }
        setPos(bv, x, y);
        if (actrow != orow)
                updateLocal(bv, NONE, false);
@@ -801,20 +808,20 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
                return;
        } else if (the_locking_inset) {
                the_locking_inset->insetUnlock(bv);
+               the_locking_inset = 0;
+               updateLocal(bv, CELL, false);
        }
-       the_locking_inset = 0;
        if (button == 2) {
                localDispatch(bv, LFUN_PASTESELECTION, "paragraph");
                return;
        }
        if (inset_hit && bv->theLockingInset()) {
-               // only activate the Inset so that no internal inset is hit
-               // by this call. It should be only hit by the insetButtonPress call.
-               if (activateCellInsetAbs(bv, 0, 0, 0))
-                       the_locking_inset->insetButtonPress(bv,
-                                                           x - inset_x,
-                                                           y - inset_y,
-                                                           button);
+               if (!bv->lockInset(static_cast<UpdatableInset*>(tabular->GetCellInset(actcell)))) {
+                       lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
+                       return;
+               }
+               the_locking_inset->insetButtonPress(
+                       bv, x - inset_x, y - inset_y, button);
                return;
        }
        showInsetCursor(bv);
index 29689b89a947985e379011acae2f24b2222cbfcc..ccaa6a8a0e79fec86de574cb09d0389636dcb4ee 100644 (file)
@@ -117,7 +117,7 @@ public:
        ///
        bool updateInsetInInset(BufferView *, Inset *);
        ///
-       unsigned int insetInInsetY();
+       int insetInInsetY() const;
        ///
        UpdatableInset * getLockingInset() const;
        ///
index 2919ea6d7230827c2f83dd98a046dad1d7f66e35..27db48df81a157b2eeb6efcca79b53ceb3fe6b3c 100644 (file)
@@ -675,9 +675,11 @@ void InsetText::edit(BufferView * bv, int x, int y, unsigned int button)
                lt = getLyXText(bv);
                clear = true;
        }
-       if (!checkAndActivateInset(bv, x, tmp_y, button))
+       if (!checkAndActivateInset(bv, x, tmp_y, button)) {
                lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
                                            y + insetAscent);
+               lt->cursor.x_fix(lt->cursor.x());
+       }
        lt->clearSelection();
        finishUndo();
        // If the inset is empty set the language of the current font to the
@@ -756,15 +758,21 @@ void InsetText::insetUnlock(BufferView * bv)
        if (the_locking_inset) {
                the_locking_inset->insetUnlock(bv);
                the_locking_inset = 0;
+               updateLocal(bv, CURSOR_PAR, false);
        }
        hideInsetCursor(bv);
        no_selection = true;
        locked = false;
        int code;
+#if 0
        if (drawFrame_ == LOCKED)
                code = CURSOR|CLEAR_FRAME;
        else
                code = CURSOR;
+#else
+       if (drawFrame_ == LOCKED)
+               code = CLEAR_FRAME;
+#endif
        bool clear = false;
        if (!lt) {
                lt = getLyXText(bv);
@@ -786,9 +794,47 @@ void InsetText::insetUnlock(BufferView * bv)
        }
        if (clear)
                lt = 0;
+#if 0
        updateLocal(bv, code, false);
+#else
+       setUpdateStatus(bv, code);
+#endif
+}
+
+
+void InsetText::lockInset(BufferView * bv)
+{
+       locked = true;
+       the_locking_inset = 0;
+       inset_pos = inset_x = inset_y = 0;
+       inset_boundary = false;
+       inset_par = 0;
+       old_par = 0;
+       bool clear = false;
+       if (!lt) {
+               lt = getLyXText(bv);
+               clear = true;
+       }
+       lt->setCursor(bv, par, 0);
+       lt->clearSelection();
+       finishUndo();
+       // If the inset is empty set the language of the current font to the
+       // language to the surronding text (if different).
+       if (par->size() == 0 && !par->next() &&
+               bv->getParentLanguage(this) != lt->current_font.language()) {
+               LyXFont font(LyXFont::ALL_IGNORE);
+               font.setLanguage(bv->getParentLanguage(this));
+               setFont(bv, font, false);
+       }
+       if (clear)
+               lt = 0;
+       int code = CURSOR;
+       if (drawFrame_ == LOCKED)
+               code = CURSOR|DRAW_FRAME;
+       setUpdateStatus(bv, code);
 }
 
+
 void InsetText::lockInset(BufferView * bv, UpdatableInset * inset)
 {
        the_locking_inset = inset;
@@ -932,6 +978,9 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
        mouse_x = x;
        mouse_y = y;
 
+       if (!locked)
+               lockInset(bv);
+
        int tmp_x = x - drawTextXOffset;
        int tmp_y = y + insetAscent - getLyXText(bv)->first_y;
        Inset * inset = bv->checkInsetHit(getLyXText(bv), tmp_x, tmp_y);
@@ -1082,6 +1131,7 @@ void InsetText::insetMotionNotify(BufferView * bv, int x, int y, int state)
        hideInsetCursor(bv);
        LyXCursor cur = lt->cursor;
        lt->setCursorFromCoordinates(bv, x - drawTextXOffset, y + insetAscent);
+       lt->cursor.x_fix(lt->cursor.x());
        if (cur == lt->cursor) {
                if (clear)
                        lt = 0;
@@ -1700,19 +1750,18 @@ int InsetText::beginningOfMainBody(Buffer const * buf, Paragraph * p) const
 }
 
 
-void InsetText::getCursorPos(BufferView * bv,
-                            int & x, int & y) const
+void InsetText::getCursorPos(BufferView * bv, int & x, int & y) const
 {
        if (the_locking_inset) {
                the_locking_inset->getCursorPos(bv, x, y);
                return;
        }
-       x = cx(bv);
-       y = cy(bv);
+       x = cx(bv) - top_x - TEXT_TO_INSET_OFFSET;
+       y = cy(bv) - TEXT_TO_INSET_OFFSET;
 }
 
 
-unsigned int InsetText::insetInInsetY()
+int InsetText::insetInInsetY() const
 {
        if (!the_locking_inset)
                return 0;
@@ -1754,7 +1803,7 @@ void InsetText::showInsetCursor(BufferView * bv, bool show)
                int const asc = lyxfont::maxAscent(font);
                int const desc = lyxfont::maxDescent(font);
 
-               bv->fitLockedInsetCursor(cx(bv), ciy(bv), asc, desc);
+               bv->fitLockedInsetCursor(cx(bv), cy(bv), asc, desc);
                if (show)
                        bv->showLockedInsetCursor(cx(bv), cy(bv), asc, desc);
                setCursorVisible(true);
index 20fcfbdaec7df4a19b31ac239a2d3e6ed95d1d3b..bb6beb768953f40fe1c03d31bee5f4fa7c683de6 100644 (file)
@@ -150,7 +150,7 @@ public:
        ///
        void getCursorPos(BufferView *, int & x, int & y) const;
        ///
-       unsigned int insetInInsetY();
+       int insetInInsetY() const;
        ///
        void toggleInsetCursor(BufferView *);
        ///
@@ -259,7 +259,9 @@ public:
 protected:
        ///
        void updateLocal(BufferView *, int what, bool mark_dirty) const;
-       ///
+       /// set parameters for an initial lock of this inset
+       void lockInset(BufferView *);
+       /// lock an inset inside this one
        void lockInset(BufferView *, UpdatableInset *);
        ///
        mutable int drawTextXOffset;
index 47489a0fddea40b4c763a51bca35ab398dea20fd..a6caad20241a40d65c2d32797944f3cb597b8414 100644 (file)
@@ -127,3 +127,15 @@ Row * LyXCursor::row() const
 {
        return row_;
 }
+
+
+void LyXCursor::irow(Row * r)
+{
+       irow_ = r;
+}
+
+
+Row * LyXCursor::irow() const
+{
+       return irow_;
+}
index fe3cc2842cc6af2cd158c6b781859f7b6acdec79..d33515c44df339bc985778d887f2ad9aaf519846 100644 (file)
@@ -63,6 +63,10 @@ public:
        void row(Row * r);
        ///
        Row * row() const;
+       ///
+       void irow(Row * r);
+       ///
+       Row * irow() const;
 private:
        /// The paragraph the cursor is in.
        Paragraph * par_;
@@ -84,6 +88,9 @@ private:
        int iy_;
        ///
        Row * row_;
+       /// the row of the position before the inset when we put
+       /// the cursor on the end of the row before, otherwise equal to row.
+       Row * irow_;
 };
 
 ///
index af1d9f9571da9494c84adde14f1591293fe653c2..d4986d6b2f463ed2dff5b28a3988b228913555d4 100644 (file)
@@ -885,6 +885,12 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
                                     (!keyseq.deleted())))
                {
+                       UpdatableInset * inset = owner->view()->theLockingInset();
+#if 1
+                       int inset_x;
+                       int dummy_y;
+                       inset->getCursorPos(owner->view(), inset_x, dummy_y);
+#endif
                        if ((action == LFUN_UNKNOWN_ACTION)
                            && argument.empty()) {
                                argument = keyseq.getiso();
@@ -896,7 +902,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                        } else if (action == LFUN_REDO) {
                                owner->view()->menuRedo();
                                goto exit_with_message;
-                       } else if (((result=owner->view()->theLockingInset()->
+                       } else if (((result=inset->
                                     // Hand-over to inset's own dispatch:
                                     localDispatch(owner->view(), action, argument)) ==
                                    UpdatableInset::DISPATCHED) ||
@@ -918,8 +924,16 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                                }
                                goto exit_with_message;
                        } else if (result == UpdatableInset::FINISHED_UP) {
-                               if (TEXT()->cursor.row()->previous()) {
+                               if (TEXT()->cursor.irow()->previous()) {
+#if 1
+                                       TEXT()->setCursorFromCoordinates(
+                                               owner->view(), TEXT()->cursor.ix() + inset_x,
+                                               TEXT()->cursor.iy() -
+                                               TEXT()->cursor.irow()->baseline() - 1);
+                                       TEXT()->cursor.x_fix(TEXT()->cursor.x());
+#else
                                        TEXT()->cursorUp(owner->view());
+#endif
                                        moveCursorUpdate(true, false);
                                        owner->showState();
                                } else {
@@ -927,10 +941,20 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                                }
                                goto exit_with_message;
                        } else if (result == UpdatableInset::FINISHED_DOWN) {
-                               if (TEXT()->cursor.row()->next())
+                               if (TEXT()->cursor.irow()->next()) {
+#if 1
+                                       TEXT()->setCursorFromCoordinates(
+                                               owner->view(), TEXT()->cursor.ix() + inset_x,
+                                               TEXT()->cursor.iy() -
+                                               TEXT()->cursor.irow()->baseline() +
+                                               TEXT()->cursor.irow()->height() + 1);
+                                       TEXT()->cursor.x_fix(TEXT()->cursor.x());
+#else                                  
                                        TEXT()->cursorDown(owner->view());
-                               else
+#endif
+                               } else {
                                        TEXT()->cursorRight(owner->view());
+                               }
                                moveCursorUpdate(true, false);
                                owner->showState();
                                goto exit_with_message;
index 089965c9973152fe4fa658a803281bbb3c92baee..64c45adcd4dba101a12f6494daff96fd2099a81f 100644 (file)
@@ -2064,6 +2064,7 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par,
        int y = 0;
        Row * row = getRow(par, pos, y);
        Row * old_row = row;
+       cur.irow(row);
        // if we are before the first char of this row and are still in the
        // same paragraph and there is a previous row then put the cursor on
        // the end of the previous row
@@ -2262,19 +2263,28 @@ void LyXText::setCursorFromCoordinates(BufferView * bview, LyXCursor & cur,
        cur.par(row->par());
        cur.pos(row->pos() + column);
        cur.x(x);
-       cur.ix(x);
        cur.y(y + row->baseline());
+       cur.row(row);
        Inset * ins;
-       if (row->next() && cur.pos() &&
+       if (row->next() && row->next()->pos() == cur.pos() &&
+               cur.par() == row->next()->par() &&
                cur.par()->getChar(cur.pos()) == Paragraph::META_INSET &&
                (ins=cur.par()->getInset(cur.pos())) &&
                (ins->needFullRow() || ins->display()))
        {
+               // we enter here if we put the cursor on the end of the row before
+               // a inset which uses a full row and in that case we HAVE to calculate
+               // the right (i) values.
+               pos_type last = rowLastPrintable(row);
+               float x = getCursorX(bview, row->next(), cur.pos(), last, bound);
+               cur.ix(int(x));
                cur.iy(y + row->height() + row->next()->baseline());
+               cur.irow(row->next());
        } else {
                cur.iy(cur.y());
+               cur.ix(cur.x());
+               cur.irow(row);
        }
-       cur.row(row);
        cur.boundary(bound);
 }
 
@@ -2311,16 +2321,41 @@ void LyXText::cursorRight(BufferView * bview, bool internal) const
 
 void LyXText::cursorUp(BufferView * bview) const
 {
+#if 1
+       int x = cursor.x_fix();
+       int y = cursor.y() - cursor.row()->baseline() - 1;
+       setCursorFromCoordinates(bview, x, y);
+       int y1 = cursor.iy() - first_y;
+       int y2 = y1;
+       Inset * inset_hit = bview->checkInsetHit(const_cast<LyXText *>(this), x, y1);
+       if (inset_hit && isHighlyEditableInset(inset_hit)) {
+               inset_hit->edit(bview, x, y - (y2 - y1), 0);
+       }
+#else
        setCursorFromCoordinates(bview, cursor.x_fix(),
                                 cursor.y() - cursor.row()->baseline() - 1);
+#endif
 }
 
 
 void LyXText::cursorDown(BufferView * bview) const
 {
+#if 1
+       int x = cursor.x_fix();
+       int y = cursor.y() - cursor.row()->baseline() +
+               cursor.row()->height() + 1;
+       setCursorFromCoordinates(bview, x, y);
+       int y1 = cursor.iy() - first_y;
+       int y2 = y1;
+       Inset * inset_hit = bview->checkInsetHit(const_cast<LyXText *>(this), x, y1);
+       if (inset_hit && isHighlyEditableInset(inset_hit)) {
+               inset_hit->edit(bview, x, y - (y2 - y1), 0);
+       }
+#else
        setCursorFromCoordinates(bview, cursor.x_fix(),
                                 cursor.y() - cursor.row()->baseline()
                                 + cursor.row()->height() + 1);
+#endif
 }