[LyX/master] FindAdv: Correct some testcases
Kornel Benko
kornel at lyx.org
Fri May 29 12:00:53 UTC 2020
commit 8028dce12910cd7cac4d872488603c225a3070a0
Author: Kornel Benko <kornel at lyx.org>
Date: Fri May 29 14:22:34 2020 +0200
FindAdv: Correct some testcases
---
development/autotests/findadv-05-in.txt | 3 ++-
development/autotests/findadv-06-in.txt | 5 ++++-
development/autotests/findadv-07-in.txt | 2 ++
development/autotests/findadv-09-in.txt | 2 ++
development/autotests/findadv-10-in.txt | 2 ++
development/autotests/findadv-11-in.txt | 1 +
development/autotests/findadv-14-in.txt | 2 ++
development/autotests/findadv-15-in.txt | 2 ++
development/autotests/findadv-re-01-in.txt | 3 +++
src/lyxfind.cpp | 11 ++++++++---
10 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/development/autotests/findadv-05-in.txt b/development/autotests/findadv-05-in.txt
index 0fcf149..1f4ba89 100644
--- a/development/autotests/findadv-05-in.txt
+++ b/development/autotests/findadv-05-in.txt
@@ -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]
diff --git a/development/autotests/findadv-06-in.txt b/development/autotests/findadv-06-in.txt
index 3fb38b6..164df32 100644
--- a/development/autotests/findadv-06-in.txt
+++ b/development/autotests/findadv-06-in.txt
@@ -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
diff --git a/development/autotests/findadv-07-in.txt b/development/autotests/findadv-07-in.txt
index 37c5b76..77f6b8b 100644
--- a/development/autotests/findadv-07-in.txt
+++ b/development/autotests/findadv-07-in.txt
@@ -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]
diff --git a/development/autotests/findadv-09-in.txt b/development/autotests/findadv-09-in.txt
index 10de532..48d1b2b 100644
--- a/development/autotests/findadv-09-in.txt
+++ b/development/autotests/findadv-09-in.txt
@@ -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
diff --git a/development/autotests/findadv-10-in.txt b/development/autotests/findadv-10-in.txt
index f4eb288..8ff7df9 100644
--- a/development/autotests/findadv-10-in.txt
+++ b/development/autotests/findadv-10-in.txt
@@ -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
diff --git a/development/autotests/findadv-11-in.txt b/development/autotests/findadv-11-in.txt
index a13d81c..81f1184 100644
--- a/development/autotests/findadv-11-in.txt
+++ b/development/autotests/findadv-11-in.txt
@@ -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
diff --git a/development/autotests/findadv-14-in.txt b/development/autotests/findadv-14-in.txt
index 022238a..c35371d 100644
--- a/development/autotests/findadv-14-in.txt
+++ b/development/autotests/findadv-14-in.txt
@@ -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
diff --git a/development/autotests/findadv-15-in.txt b/development/autotests/findadv-15-in.txt
index cfe6be4..7a4899d 100644
--- a/development/autotests/findadv-15-in.txt
+++ b/development/autotests/findadv-15-in.txt
@@ -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
diff --git a/development/autotests/findadv-re-01-in.txt b/development/autotests/findadv-re-01-in.txt
index 468b17d..667b77c 100644
--- a/development/autotests/findadv-re-01-in.txt
+++ b/development/autotests/findadv-re-01-in.txt
@@ -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
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index b9633bc..c65d2ca 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -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
More information about the lyx-cvs
mailing list