]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
When we use InPremable styles, we want to write as many versions
[lyx.git] / src / Paragraph.cpp
index 9fe4de821d0daec36bfe91a9c09b1aa878023e29..a396794ebd77c3681a0da0da858ad7be237533ca 100644 (file)
@@ -1192,7 +1192,9 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
                break;
        case '-':
                os << '-';
-               if (i + 1 < end_pos && text_[i+1] == '-') {
+               if (i + 1 < static_cast<pos_type>(text_.size()) &&
+                   (end_pos == -1 || i + 1 < end_pos) &&
+                   text_[i+1] == '-') {
                        // Prevent "--" becoming an endash and "---" becoming
                        // an emdash.
                        // Within \ttfamily, "--" is merged to "-" (no endash)
@@ -1395,7 +1397,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
                                }
                        }
                        string const snippet = to_utf8(ods.str());
-                       features.addPreambleSnippet(snippet);
+                       features.addPreambleSnippet(snippet, true);
                }
        }