From: Yuriy Skalko Date: Sat, 23 Jan 2021 22:46:00 +0000 (+0200) Subject: Add test for bug #12069 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=dff4779b06b9b5693bc3f2d632f1e34a93b43277;p=features.git Add test for bug #12069 --- diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 092375c087..bc2b0746ed 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -256,10 +256,12 @@ bool searchAllowed(docstring const & str) return true; } +} // namespace + bool findOne(BufferView * bv, docstring const & searchstr, bool case_sens, bool whole, bool forward, - bool find_del = true, bool check_wrap = false) + bool find_del, bool check_wrap) { if (!searchAllowed(searchstr)) return false; @@ -307,6 +309,8 @@ bool findOne(BufferView * bv, docstring const & searchstr, } +namespace { + int replaceAll(BufferView * bv, docstring const & searchstr, docstring const & replacestr, bool case_sens, bool whole) diff --git a/src/lyxfind.h b/src/lyxfind.h index 30c1ddde0d..00414f1ce7 100644 --- a/src/lyxfind.h +++ b/src/lyxfind.h @@ -55,6 +55,10 @@ docstring const replace2string(docstring const & replace, */ bool lyxfind(BufferView * bv, FuncRequest const & ev); +bool findOne(BufferView * bv, docstring const & searchstr, + bool case_sens, bool whole, bool forward, + bool find_del = true, bool check_wrap = false); + /** Parse the string encoding of the replace request that is found in * \c ev.argument and act on it. * The string is encoded by \c replace2string. diff --git a/src/test/issues/12069.cpp b/src/test/issues/12069.cpp new file mode 100644 index 0000000000..653c566ef3 --- /dev/null +++ b/src/test/issues/12069.cpp @@ -0,0 +1,20 @@ +#include +#include + +#include "Buffer.h" +#include "BufferView.h" +#include "Changes.h" +#include "Font.h" +#include "lyxfind.h" +#include "Paragraph.h" +#include "Text.h" + +using namespace lyx; + + +TEST_CASE("no false matches in deleted text") { + Buffer b("noname"); + BufferView bv(b); + b.paragraphs()[0].insert(0, from_utf8("some text"), Font(), Change(Change::DELETED)); + CHECK_FALSE(findOne(&bv, from_utf8("abc"), false, false, true, false, false)); +}