]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfind.cpp
Use Common Number separator instead of European to detect numbers
[lyx.git] / src / lyxfind.cpp
index b9633bc7f9f66dc2532e3406f1fc79641ac62444..70de6c96a816164aadd5da2ddb6fa88b1243a71a 100644 (file)
@@ -968,9 +968,9 @@ static size_t identifyLeading(string const & s)
        // + allow to search for colored text too
        while (regex_replace(t, t, REGEX_BOS "\\\\(((footnotesize|tiny|scriptsize|small|large|Large|LARGE|huge|Huge|emph|noun|minisec|text(bf|md|sl|sf|it|tt))|((textcolor|foreignlanguage|latexenvironment)\\{[a-z]+\\*?\\})|(u|uu)line|(s|x)out|uwave)|((sub)?(((sub)?section)|paragraph)|part|chapter)\\*?)\\{", "")
               || regex_replace(t, t, REGEX_BOS "\\$", "")
-              || regex_replace(t, t, REGEX_BOS "\\\\\\[ ", "")
+              || regex_replace(t, t, REGEX_BOS "\\\\\\[", "")
               || regex_replace(t, t, REGEX_BOS " ?\\\\item\\{[a-z]+\\}", "")
-              || regex_replace(t, t, REGEX_BOS "\\\\begin\\{[a-zA-Z_]*\\*?\\} ", ""))
+              || regex_replace(t, t, REGEX_BOS "\\\\begin\\{[a-zA-Z_]*\\*?\\}", ""))
               ;
        LYXERR(Debug::FIND, "  after removing leading $, \\[ , \\emph{, \\textbf{, etc.: '" << t << "'");
        return s.find(t);
@@ -2711,9 +2711,9 @@ static int identifyClosing(string & t)
                LYXERR(Debug::FIND, "identifyClosing(): t now is '" << t << "'");
                if (regex_replace(t, t, "(.*[^\\\\])\\$" REGEX_EOS, "$1"))
                        continue;
-               if (regex_replace(t, t, "(.*[^\\\\]) \\\\\\]" REGEX_EOS, "$1"))
+               if (regex_replace(t, t, "(.*[^\\\\])\\\\\\]" REGEX_EOS, "$1"))
                        continue;
-               if (regex_replace(t, t, "(.*[^\\\\]) \\\\end\\{[a-zA-Z_]*\\*?\\}" REGEX_EOS, "$1"))
+               if (regex_replace(t, t, "(.*[^\\\\])\\\\end\\{[a-zA-Z_]*\\*?\\}" REGEX_EOS, "$1"))
                        continue;
                if (regex_replace(t, t, "(.*[^\\\\])\\}" REGEX_EOS, "$1")) {
                        ++open_braces;
@@ -3040,9 +3040,14 @@ MatchResult MatchStringAdv::operator()(DocIterator const & cur, int len, bool at
        bool ws_left = (cur.pos() > 0)
                ? par.isWordSeparator(cur.pos() - 1)
                : true;
-       bool ws_right = (cur.pos() + len < par.size())
+       bool ws_right;
+       if (len < 0)
+               ws_right = true;
+       else {
+               ws_right = (cur.pos() + len < par.size())
                ? par.isWordSeparator(cur.pos() + len)
                : true;
+       }
        LYXERR(Debug::FIND,
               "cur.pos()=" << cur.pos() << ", res=" << res
               << ", separ: " << ws_left << ", " << ws_right