]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Revert unintended commit.
[lyx.git] / src / BufferView.cpp
index 3c2fd470f4bbb4a93d125b26bfda6c01b30264a5..3be5cf7cf283969c8408786d61bc1f72416c5880 100644 (file)
@@ -729,7 +729,7 @@ bool BufferView::moveToPosition(pit_type bottom_pit, pos_type bottom_pos,
                        // insets.
                        size_t const n = dit.depth();
                        for (size_t i = 0; i < n; ++i)
-                               if (dit[i].inset().editable() != Inset::HIGHLY_EDITABLE) {
+                               if (!dit[i].inset().editable()) {
                                        dit.resize(i);
                                        break;
                                }
@@ -943,7 +943,7 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                flag.setEnabled(! this->cursor().inRegexped());
                break;
 
-       case LFUN_COPY_LABEL_AS_REF: {
+       case LFUN_LABEL_COPY_AS_REF: {
                // if there is an inset at cursor, see whether it
                // handles the lfun
                Inset * inset = cur.nextInset();
@@ -1357,9 +1357,12 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                // turn compression on/off
                buffer_.params().compressed = !buffer_.params().compressed;
                break;
-       case LFUN_COPY_LABEL_AS_REF: {
+
+       case LFUN_LABEL_COPY_AS_REF: {
                // if there is an inset at cursor, try to copy it
-               Inset * inset = cur.nextInset();
+               Inset * inset = &cur.inset();
+               if (!inset || !inset->asInsetMath())
+                       inset = cur.nextInset();
                if (inset) {
                        FuncRequest tmpcmd = cmd;
                        inset->dispatch(cur, tmpcmd);
@@ -1371,6 +1374,7 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                processUpdateFlags(Update::SinglePar | Update::FitCursor);
                break;
        }
+
        case LFUN_NEXT_INSET_MODIFY: {
                // create the the real function we want to invoke
                FuncRequest tmpcmd = cmd;
@@ -1399,14 +1403,16 @@ bool BufferView::dispatch(FuncRequest const & cmd)
        case LFUN_SCREEN_UP:
        case LFUN_SCREEN_DOWN: {
                Point p = getPos(cur, cur.boundary());
-               if (p.y_ < 0 || p.y_ > height_) {
+               // This code has been commented out to enable to scroll down a
+               // document, even if there are large insets in it (see bug #5465).
+               /*if (p.y_ < 0 || p.y_ > height_) {
                        // The cursor is off-screen so recenter before proceeding.
                        showCursor();
                        p = getPos(cur, cur.boundary());
-               }
+               }*/
                int const scrolled = scroll(cmd.action == LFUN_SCREEN_UP
-                       ? - height_ : height_);
-               if (cmd.action == LFUN_SCREEN_UP && scrolled > - height_)
+                       ? -height_ : height_);
+               if (cmd.action == LFUN_SCREEN_UP && scrolled > -height_)
                        p = Point(0, 0);
                if (cmd.action == LFUN_SCREEN_DOWN && scrolled < height_)
                        p = Point(width_, height_);
@@ -1415,7 +1421,8 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                cur.reset(buffer_.inset());
                updateMetrics();
                buffer_.changed();
-               d->text_metrics_[&buffer_.text()].editXY(cur, p.x_, p.y_);
+               d->text_metrics_[&buffer_.text()].editXY(cur, p.x_, p.y_,
+                       true, cmd.action == LFUN_SCREEN_UP); 
                //FIXME: what to do with cur.x_target()?
                bool update = in_texted && cur.bv().checkDepm(cur, old);
                cur.finishUndo();
@@ -1911,6 +1918,7 @@ bool BufferView::mouseSetCursor(Cursor & cur, bool select)
        bool update = leftinset;
        if (!do_selection && d->cursor_.inTexted())
                update |= checkDepm(cur, d->cursor_);
+       d->cursor_.macroModeClose();
 
        d->cursor_.setCursor(cur);
        d->cursor_.boundary(cur.boundary());