]> git.lyx.org Git - features.git/commitdiff
Bug #9005: various things that do not work as intended in passthru paragraphs
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 4 Mar 2014 10:56:03 +0000 (11:56 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 4 Mar 2014 10:56:03 +0000 (11:56 +0100)
* disable branch-add-insert in pass thru paragraphs

* when it is not possible to input a quote inset, insert a single
  ascii quote when argument to quote-insert is "single"

* handle "mathspace" dialog in Text::getStatus

* disable insertion of newline inset in pass thru paragraphs

* handle "mathdelimiter" and "mathmatrix" dialogs in GuiView::getStatus.

src/BufferView.cpp
src/Text3.cpp
src/frontends/qt4/GuiView.cpp

index 84194605a59200d3a6f816f22aa40e02d73e6720..7555f78633dd11b10e299018fcc2d80d17c51de5 100644 (file)
@@ -1079,7 +1079,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
        case LFUN_BIBTEX_DATABASE_ADD:
        case LFUN_BIBTEX_DATABASE_DEL:
        case LFUN_STATISTICS:
-       case LFUN_BRANCH_ADD_INSERT:
        case LFUN_KEYMAP_OFF:
        case LFUN_KEYMAP_PRIMARY:
        case LFUN_KEYMAP_SECONDARY:
@@ -1154,6 +1153,10 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                flag.setEnabled(cur.inset().allowParagraphCustomization(cur.idx()));
                break;
 
+       case LFUN_BRANCH_ADD_INSERT:
+               flag.setEnabled(!(cur.inTexted() && cur.paragraph().isPassThru()));
+               break;
+
        case LFUN_DIALOG_SHOW_NEW_INSET:
                // FIXME: this is wrong, but I do not understand the
                // intent (JMarc)
index 340bb9ec296ff5da6a2bc6a73fc7e12b78249157..41723b611f129b44dad252adb10535d6bfd0d537 100644 (file)
@@ -1472,12 +1472,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                bool const hebrew = 
                        par.getFontSettings(bufparams, pos).language()->lang() == "hebrew";
                bool const allow_inset_quote = !(par.isPassThru() || hebrew);
-               
+
+               string const arg = to_utf8(cmd.argument());
                if (allow_inset_quote) {
                        char_type c = ' ';
                        if (pos > 0 && (!cur.prevInset() || !cur.prevInset()->isSpace()))
                                c = par.getChar(pos - 1);
-                       string const arg = to_utf8(cmd.argument());
                        InsetQuotes::QuoteTimes const quote_type = (arg == "single")
                                ? InsetQuotes::SingleQuotes : InsetQuotes::DoubleQuotes;
                        cur.insert(new InsetQuotes(cur.buffer(), c, quote_type));
@@ -1485,8 +1485,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                } else {
                        // The cursor might have been invalidated by the replaceSelection.
                        cur.buffer()->changed(true);
-                       lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, "\""));
-               }                       
+                       string const quote_string = (arg == "single") ? "'" : "\"";
+                       lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, quote_string));
+               }
                break;
        }
 
@@ -2472,6 +2473,10 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                        code = INDEX_CODE;
                else if (cmd.argument() == "index_print")
                        code = INDEX_PRINT_CODE;
+               else if (cmd.argument() == "listings")
+                       code = LISTINGS_CODE;
+               else if (cmd.argument() == "mathspace")
+                       code = MATH_HULL_CODE;
                else if (cmd.argument() == "nomenclature")
                        code = NOMENCL_CODE;
                else if (cmd.argument() == "nomencl_print")
@@ -2494,8 +2499,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                        code = VSPACE_CODE;
                else if (cmd.argument() == "wrap")
                        code = WRAP_CODE;
-               else if (cmd.argument() == "listings")
-                       code = LISTINGS_CODE;
                break;
 
        case LFUN_ERT_INSERT:
@@ -2896,7 +2899,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
 
        case LFUN_NEWLINE_INSERT:
                // LaTeX restrictions (labels or empty par)
-               enable = (cur.pos() > cur.paragraph().beginOfBody());
+               enable = !cur.paragraph().isPassThru()
+                       && cur.pos() > cur.paragraph().beginOfBody();
                break;
 
        case LFUN_TAB_INSERT:
index 7b69bb97b1682639c6bd79f282bb487a56ee39ff..28c6f3a40f0576cba188fbf03498ab54882d0a6c 100644 (file)
@@ -1732,7 +1732,8 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                else if (name == "print")
                        enable = doc_buffer->params().isExportable("dvi")
                                && lyxrc.print_command != "none";
-               else if (name == "character" || name == "symbols") {
+               else if (name == "character" || name == "symbols"
+                       || name == "mathdelimiter" || name == "mathmatrix") {
                        if (!buf || buf->isReadonly())
                                enable = false;
                        else {