]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
add the background image to distribution tarball
[lyx.git] / src / Text3.cpp
index f54e8f4b5ae9115f06c56f899b1b6d4fcf5ac4a9..764c22d4e76f16ff35dcd4c3bc007a5fb8b8812b 100644 (file)
@@ -1406,7 +1406,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                lyx::dispatch(FuncRequest(LFUN_DEPTH_DECREMENT));
                }
                bool const morecont = cur.lastpos() > cur.pos();
-               lyx::dispatch(FuncRequest(LFUN_LAYOUT, "Separator"));
+               // FIXME This hardcoding is bad
+               docstring const sep =
+                               cur.buffer()->params().documentClass().hasLayout(from_ascii("Separator"))
+                                       ? from_ascii("Separator") : from_ascii("--Separator--");
+               lyx::dispatch(FuncRequest(LFUN_LAYOUT, sep));
                lyx::dispatch(FuncRequest(LFUN_PARAGRAPH_BREAK, "inverse"));
                if (morecont) 
                        lyx::dispatch(FuncRequest(LFUN_DOWN));
@@ -1472,12 +1476,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 +1489,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;
        }
 
@@ -1689,11 +1694,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        // invalid after regex_match returns, since it is then
                        // being given a temporary object. (Thanks to Georg for
                        // figuring that out.)
-                       regex const link_re("^([a-zA-Z]+):.*");
+                       regex const link_re("^([a-z]+):.*");
                        smatch matches;
-                       string const c = to_utf8(content);
+                       string const c = to_utf8(lowercase(content));
 
-                       if (content.substr(0,7) == "mailto:") {
+                       if (c.substr(0,7) == "mailto:") {
                                p["target"] = content;
                                p["type"] = from_ascii("mailto:");
                        } else if (regex_match(c, matches, link_re)) {
@@ -2472,6 +2477,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 +2503,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 +2903,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:
@@ -2946,7 +2954,9 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                break;
        
        case LFUN_ENVIRONMENT_SPLIT: {
-               if (!cur.buffer()->params().documentClass().hasLayout(from_ascii("Separator"))) {
+               // FIXME This hardcoding is bad
+               if (!cur.buffer()->params().documentClass().hasLayout(from_ascii("Separator"))
+                   && !cur.buffer()->params().documentClass().hasLayout(from_ascii("--Separator--"))) {
                        enable = false;
                        break;
                }