X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxfind.cpp;h=bb53c35854739da4d9138dd7785bcdb38430b352;hb=2455bc258f3b62c29ec4a41cb88070ff8518e842;hp=514ee4595adc0018d29ed170145b94b7bfa3ff4f;hpb=b89cc942eb458284f40f4d4e7db58890c3288979;p=lyx.git diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 514ee4595a..bb53c35854 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -22,9 +22,7 @@ #include "buffer_funcs.h" #include "BufferView.h" #include "Changes.h" -#include "support/debug.h" #include "FuncRequest.h" -#include "support/gettext.h" #include "Text.h" #include "Paragraph.h" #include "ParIterator.h" @@ -32,7 +30,9 @@ #include "frontends/alert.h" #include "support/convert.h" +#include "support/debug.h" #include "support/docstream.h" +#include "support/gettext.h" #include "support/lstrings.h" using namespace std; @@ -52,7 +52,7 @@ bool parse_bool(docstring & howto) } -class MatchString : public std::binary_function +class MatchString : public binary_function { public: MatchString(docstring const & str, bool cs, bool mw) @@ -208,6 +208,7 @@ int replace(BufferView * bv, docstring const & searchstr, cap::replaceSelectionWithString(cur, replacestr, fw); bv->buffer().markDirty(); find(bv, searchstr, cs, mw, fw, false); + bv->buffer().updateMacros(); bv->processUpdateFlags(Update::Force | Update::FitCursor); return 1; @@ -243,12 +244,12 @@ docstring const replace2string(docstring const & search, docstring const & repla } -void find(BufferView * bv, FuncRequest const & ev) +bool find(BufferView * bv, FuncRequest const & ev) { if (!bv || ev.action != LFUN_WORD_FIND) - return; + return false; - //lyxerr << "find called, cmd: " << ev << std::endl; + //lyxerr << "find called, cmd: " << ev << endl; // data is of the form // " @@ -260,12 +261,7 @@ void find(BufferView * bv, FuncRequest const & ev) bool matchword = parse_bool(howto); bool forward = parse_bool(howto); - bool const found = find(bv, search, - casesensitive, matchword, forward); - - if (!found) - // emit message signal. - bv->message(_("String not found!")); + return find(bv, search, casesensitive, matchword, forward); } @@ -311,11 +307,9 @@ void replace(BufferView * bv, FuncRequest const & ev, bool has_deleted) } else { // if we have deleted characters, we do not replace at all, but // rather search for the next occurence - bool const found = find(bv, search, - casesensitive, matchword, forward); - - if (!found) - // emit message signal. + if (find(bv, search, casesensitive, matchword, forward)) + bv->showCursor(); + else bv->message(_("String not found!")); } }