]> git.lyx.org Git - features.git/commitdiff
Fix bug 10074 (regression)
authorGeorg Baum <baum@lyx.org>
Sun, 24 Apr 2016 18:12:43 +0000 (20:12 +0200)
committerGeorg Baum <baum@lyx.org>
Sun, 24 Apr 2016 18:12:43 +0000 (20:12 +0200)
This was a regression of 8aa37c43. I did not take into account that end_pos
could be -1, so the code that checked whether a pair of braces needs to be
inserted between two hyphens did not work for that case. Now we check for
the length of text_, which should be done anyway, and only take end_pos into
account when it is not -1.

src/Paragraph.cpp

index 9fe4de821d0daec36bfe91a9c09b1aa878023e29..a405b6a806d7d2fd8f49f8bbb08b339a16e2c73a 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)