]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
Merge branch 'master' of git.lyx.org:lyx
[lyx.git] / src / Text3.cpp
index fbcd9b7206a2dd4f0c51810fcabce05af22dc925..0467aa8b69f4fa26dac881bbd683894140d23f2c 100644 (file)
@@ -178,7 +178,7 @@ static void mathDispatch(Cursor & cur, FuncRequest const & cmd)
                        LASSERT(cur.inMathed(), return);
                        cur.pos() = 0;
                        cur.resetAnchor();
-                       cur.setSelection(true);
+                       cur.selection(true);
                        cur.pos() = cur.lastpos();
                        if (cmd.action() != LFUN_MATH_MODE)
                                // LFUN_MATH_MODE has a different meaning in math mode
@@ -1661,6 +1661,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
                tm->setCursorFromCoordinates(cur, cmd.x(), y);
                cur.setTargetX(cmd.x());
+               // Don't allow selecting a separator inset
+               if (cur.pos() && cur.paragraph().isEnvSeparator(cur.pos() - 1))
+                       cur.posBackward();
                if (cmd.y() >= wh)
                        lyx::dispatch(FuncRequest(LFUN_DOWN_SELECT));
                else if (cmd.y() < 0)
@@ -1675,7 +1678,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                // We continue with our existing selection or start a new one, so don't
                // reset the anchor.
                bvcur.setCursor(cur);
-               bvcur.setSelection(true);
+               bvcur.selection(true);
                if (cur.top() == old) {
                        // We didn't move one iota, so no need to update the screen.
                        cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor);
@@ -2057,7 +2060,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        cur.push(*inset);
                        cur.top().pos() = cur.top().lastpos();
                        cur.resetAnchor();
-                       cur.setSelection(true);
+                       cur.selection(true);
                        cur.top().pos() = 0;
                }
                break;
@@ -2433,7 +2436,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_ESCAPE:
                if (cur.selection()) {
-                       cur.setSelection(false);
+                       cur.selection(false);
                } else {
                        cur.undispatched();
                        // This used to be LFUN_FINISHED_RIGHT, I think FORWARD is more
@@ -2718,7 +2721,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_CAPTION_INSERT: {
                code = CAPTION_CODE;
                string arg = cmd.getArg(0);
-               bool varia = arg != "LongTableNoNumber"
+               bool varia = arg != "Unnumbered"
                        && cur.inset().allowsCaptionVariation(arg);
                // not allowed in description items,
                // and in specific insets
@@ -3106,7 +3109,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                docstring layout = cmd.argument();
                if (layout.empty())
                        layout = tclass.defaultLayoutName();
-               enable = !cur.inset().forcePlainLayout() && tclass.hasLayout(layout);
+               enable = !owner_->forcePlainLayout() && tclass.hasLayout(layout);
 
                flag.setOnOff(layout == cur.paragraph().layout().name());
                break;
@@ -3142,7 +3145,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_PARAGRAPH_PARAMS:
        case LFUN_PARAGRAPH_PARAMS_APPLY:
        case LFUN_PARAGRAPH_UPDATE:
-               enable = cur.inset().allowParagraphCustomization();
+               enable = owner_->allowParagraphCustomization();
                break;
 
        // FIXME: why are accent lfuns forbidden with pass_thru layouts?