]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
* InsetListings.cpp:
[lyx.git] / src / Text3.cpp
index 04de6b7bc2ba52779ed472a15c43043b2fe17095..e5a1814b0e5cc8300698d59ad4ee605cec33ad95 100644 (file)
@@ -885,8 +885,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                                      bv->buffer().params().trackChanges);
                                // Update the selection pos to make sure the selection does not
                                // change as the inserted tab will increase the logical pos.
-                               if (cur.anchor_.pit() == pit)
-                                       cur.anchor_.forwardPos();
+                               if (cur.realAnchor().pit() == pit)
+                                       cur.realAnchor().forwardPos();
                                if (cur.pit() == pit)
                                        cur.forwardPos();
                        }
@@ -912,8 +912,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                if (par.getChar(0) == '\t') {
                                        if (cur.pit() == pit)
                                                cur.posBackward();
-                                       if (cur.anchor_.pit() == pit && cur.anchor_.pos() > 0 )
-                                               cur.anchor_.backwardPos();
+                                       if (cur.realAnchor().pit() == pit && cur.realAnchor().pos() > 0 )
+                                               cur.realAnchor().backwardPos();
                                        
                                        par.eraseChar(0, tc);
                                } else 
@@ -922,8 +922,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                             par.getChar(0) == ' ' && n_spaces < 4; ++n_spaces) {
                                                if (cur.pit() == pit)
                                                        cur.posBackward();
-                                               if (cur.anchor_.pit() == pit && cur.anchor_.pos() > 0 )
-                                                       cur.anchor_.backwardPos();
+                                               if (cur.realAnchor().pit() == pit && cur.realAnchor().pos() > 0 )
+                                                       cur.realAnchor().backwardPos();
                                                
                                                par.eraseChar(0, tc);
                                        }
@@ -1403,7 +1403,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                }
                // ignore motions deeper nested than the real anchor
                Cursor & bvcur = cur.bv().cursor();
-               if (!bvcur.anchor_.hasPart(cur)) {
+               if (!bvcur.realAnchor().hasPart(cur)) {
                        cur.undispatched();
                        break;
                }
@@ -1570,7 +1570,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_ERT_INSERT:
        case LFUN_LISTING_INSERT:
        case LFUN_MARGINALNOTE_INSERT:
-       case LFUN_OPTIONAL_INSERT:
+       case LFUN_ARGUMENT_INSERT:
        case LFUN_INDEX_INSERT:
        case LFUN_PREVIEW_INSERT:
                // Open the inset, and move the current selection
@@ -2288,7 +2288,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                        if (cit == floats.end() ||
                                        // and that we know how to generate a list of them
                            (!cit->second.needsFloatPkg() && cit->second.listCommand().empty())) {
-                               flag.unknown(true);
+                               flag.setUnknown(true);
                                // probably not necessary, but...
                                enable = false;
                        }
@@ -2341,11 +2341,13 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_INFO_INSERT:
                code = INFO_CODE;
                break;
-       case LFUN_OPTIONAL_INSERT:
-               code = OPTARG_CODE;
-               enable = cur.paragraph().insetList().count(OPTARG_CODE)
-                       < cur.paragraph().layout().optionalargs;
+       case LFUN_ARGUMENT_INSERT: {
+               code = ARG_CODE;
+               Layout const & lay = cur.paragraph().layout();
+               int const numargs = lay.reqargs + lay.optargs;
+               enable = cur.paragraph().insetList().count(ARG_CODE) < numargs;
                break;
+       }
        case LFUN_INDEX_INSERT:
                code = INDEX_CODE;
                break;