]> git.lyx.org Git - lyx.git/commitdiff
FindAdv: Correct some testcases
authorKornel Benko <kornel@lyx.org>
Fri, 29 May 2020 12:22:34 +0000 (14:22 +0200)
committerKornel Benko <kornel@lyx.org>
Fri, 29 May 2020 12:22:34 +0000 (14:22 +0200)
development/autotests/findadv-05-in.txt
development/autotests/findadv-06-in.txt
development/autotests/findadv-07-in.txt
development/autotests/findadv-09-in.txt
development/autotests/findadv-10-in.txt
development/autotests/findadv-11-in.txt
development/autotests/findadv-14-in.txt
development/autotests/findadv-15-in.txt
development/autotests/findadv-re-01-in.txt
src/lyxfind.cpp

index 0fcf149af52bf4c033a14d03164c7cbd7c62ca19..1f4ba89d79f60c3184b9770d1fca92e01c7f1e20 100644 (file)
@@ -3,13 +3,14 @@
 Lang sk_SK.utf8
 CO: findadv-05.ctrl
 TestBegin test.lyx -dbg key,find > findadv-05.loga.txt 2>&1
-KD: 50
+KD: 100
 CN: Part 1
 KK: foo \Cefoo foo\Ce foo\C\[Home]
 KK: \Cs
 KK: \CF
 # Uncheck ignore format
 KK: \At\Ai\Ah
+KK: \CF
 # Select emphasised
 KK: \Ce
 KK: foo\[Return]
index 3fb38b61f646092c3e9cfb3e814989350754d463..164df32cc1003d4630d183bb4210c7a50f676cc7 100644 (file)
@@ -14,6 +14,7 @@ KK: \Axbuffer-write\[Return]
 KK: \Axdialog-show findreplaceadv\[Return]
 # Uncheck ignore format
 KK: \At\Ai\Ah
+KK: \CF
 KK: \Aj
 KK: \Ao2
 KK: foo\[Return]
@@ -26,9 +27,11 @@ KK: \Axdialog-show findreplaceadv\[Return]
 KK: \[Delete]
 # Uncheck ignore format
 #KK: \At\Ai\Ah
+#KK: \CF
 KK: \Ao9
-KK: foo\[Return]\[Return]
+KK: foo\[Return]\[Return]\[Return]
 CP: Putting selection at .*idx: 0 par: 0 pos: 0\n with len: 3
+CP: Putting selection at .*idx: 0 par: 1 pos: 0\n with len: 3
 CP: Putting selection at .*idx: 0 par: 2 pos: 0\n with len: 3
 TestEnd
 Lang C
index 37c5b7623a1597d7f3bced925d84096a392fbe5d..77f6b8b2d31f330f8e6639bfcadd21bbca9363df 100644 (file)
@@ -15,6 +15,7 @@ KK: \Axbuffer-write\[Return]
 KK: \Axdialog-show findreplaceadv\[Return]
 # Uncheck ignore format
 KK: \At\Ai\Ah
+KK: \CF
 KK: \Aob
 Sleep 1
 KK: foo\[Return]
@@ -27,6 +28,7 @@ KK: \CF
 KK: \[Delete]
 # Uncheck ignore format
 #KK: \At\Ai\Ah
+#KK: \CF
 KK: \Aob
 Sleep 1
 KK: bar\[Return]
index 10de532daa473753de8f7d2626dc9e9dbcaaa744..48d1b2bd4470be28b73835e1c3b2ea0e21055d17 100644 (file)
@@ -9,6 +9,7 @@ KK: one\[Return]two\[Return]three\C\[Home]\Cs
 KK: \CF
 # Uncheck ignore format
 KK: \At\Ai\Ah
+KK: \CF
 KK: \Aob
 KK: \Axregexp-mode\[Return][a-z]* \[Return]
 CP: Putting selection at .*idx: 0 par: 0 pos: 0\n with len: 3
@@ -20,6 +21,7 @@ KK: \CF
 KK: \[Delete]
 # Uncheck ignore format
 #KK: \At\Ai\Ah
+#KK: \CF
 KK: \Aob
 KK: \Axregexp-mode\[Return][a-z]* \[Return]\[Return]
 CP: Putting selection at .*idx: 0 par: 0 pos: 0\n with len: 3
index f4eb288b864606665e5e6aba08a4c545afb32b79..8ff7df9ac480f47aa306a203f501ea9e58c544c0 100644 (file)
@@ -11,6 +11,7 @@ KK: \Cs
 KK: \CF
 # Uncheck ignore format (depends on IT language)
 KK: \At\Ai\Ah
+KK: \CF
 KK: LyX\[Return]
 CP: Putting selection at .*idx: 0 par: 0 pos: 8\n with len: 3
 #
@@ -21,6 +22,7 @@ KK: \CF
 KK: \[Delete]
 # Uncheck ignore format
 #KK: \At\Ai\Ah
+#KK: \CF
 KK: LaTeX\[Return]
 CP: Putting selection at .*idx: 0 par: 1 pos: 10\n with len: 5
 TestEnd
index a13d81c8ac80fabe1118ec566e9dfeb20beea4cf..81f11840928c763f2f94caa3b47bbfca8c5477c4 100644 (file)
@@ -21,6 +21,7 @@ KK: \CF
 KK: \[Delete]
 # Uncheck ignore format
 KK: \Az\Ag\Ae
+KK: \CF
 KK: \Cm
 KK: v\[Return]
 CP: Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n.*idx: 1 par: 0 pos: 0\n with len: 1
index 022238a43457a750bbac73327619f80917783749..c35371d1c68d0e2d14dae847650c318f28d8c4f4 100644 (file)
@@ -12,6 +12,7 @@ KK: \Cs
 KK: \CF
 # Uncheck ignore format
 KK: \At\Ai\Ah
+KK: \CF
 KK: \Amd
 KK: x^2\[Return]
 CP: Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n with len: 1
@@ -33,6 +34,7 @@ CP: Key (queried) [action=buffer-begin][Ctrl+Home]
 KK: \CF
 KK: \[Delete]
 KK: \At\Ai\Ah
+KK: \CF
 KK: \Amd
 KK: x^2\[Return]
 CP: Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n with len: 1
index cfe6be47e43bbbd500ef1ac7a4566d0846e48152..7a4899dbc61c3b03af26b3da6c186d8ba3ae5d05 100644 (file)
@@ -13,6 +13,7 @@ KK: \Cs
 KK: \CF
 # Uncheck ignore format
 KK: \At\Ai\Ah
+KK: \CF
 KK: \C\[F22]
 KK: x^2\[Return]
 CP: Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n with len: 1
@@ -35,6 +36,7 @@ KK: \CF
 KK: \[Delete]
 # Check ignore format (was unchecked)
 KK: \At\Ai\Ah
+KK: \CF
 KK: \C\[F22]
 KK: x^2\[Return]
 CP: Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n with len: 1
index 468b17d75af7ce28453c1f25bdf4e0ef1330df97..667b77c61c85670d554a38319a1eabd988397176 100644 (file)
@@ -1,6 +1,7 @@
 # Finding special latex/regexp chars: (
 #
 Lang it_IT.utf8
+KD: 100
 CO: findadv-re-01.ctrl
 TestBegin test.lyx -dbg key,find > findadv-re-01.loga.txt 2>&1
 CN: Part 1
@@ -18,6 +19,7 @@ CN: Part 2
 KK: \CF
 # Uncheck ignore format
 KK: \At\Ai\Ah
+KK: \CF
 KK: \Axregexp-mode\[Return]\\(\[Return]
 CP: Putting selection at .*idx: 0 par: 0 pos: 1\n with len: 1
 TestEnd
@@ -40,6 +42,7 @@ CN: Part 4
 KK: \CF
 # Uncheck ignore format
 KK: \At\Ai\Ah
+KK: \CF
 KK: \Axregexp-mode\[Return]\\[\[Return]
 CP: Putting selection at .*idx: 0 par: 0 pos: 3\n with len: 1
 TestEnd
index b9633bc7f9f66dc2532e3406f1fc79641ac62444..c65d2ca7c05011211ac655b6d8e9985e4d41f664 100644 (file)
@@ -968,7 +968,7 @@ 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_]*\\*?\\} ", ""))
               ;
@@ -2711,7 +2711,7 @@ 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"))
                        continue;
@@ -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