]> git.lyx.org Git - features.git/commitdiff
FindAdv: Amend cd4ae51f
authorKornel Benko <kornel@lyx.org>
Mon, 4 Mar 2019 13:37:10 +0000 (14:37 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 12:39:59 +0000 (14:39 +0200)
Prevent to match only part of a macro.
For instance, we want find '\imath' but not '\imathxxxx'
while checking for accents.

src/lyxfind.cpp

index eeb4829510b4763ed19783ba50539c7ff6052d82..83d99a10e4fb11eedd1767e4dd9df98f9d191426 100644 (file)
@@ -1329,7 +1329,7 @@ void Intervall::removeAccents()
 {
   if (accents.empty())
     buildAccentsMap();
-  static regex const accre("\\\\((.|grave|breve|u|lyxmathsym|ddot|dot|acute|dacute|mathring|check|hat|bar|tilde)\\{[^\\{\\}]+\\}|i|imath|jmath)");
+  static regex const accre("\\\\((.|grave|breve|lyxmathsym|ddot|dot|acute|dacute|mathring|check|hat|bar|tilde)\\{[^\\{\\}]+\\}|(i|imath|jmath)(?![a-zA-Z]))");
   smatch sub;
   for (sregex_iterator itacc(par.begin(), par.end(), accre), end; itacc != end; ++itacc) {
     sub = *itacc;