commit ad56bded0370cbad601ec5374a4eb1561b204d80
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Tue Mar 4 11:56:03 2014 +0100

    Bug #9005: various things that do not work as intended in passthru 
paragraphs
    
    * 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.

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 8419460..7555f78 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -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)
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 340bb9e..41723b6 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -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:
diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index 7b69bb9..28c6f3a 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -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 {

Reply via email to