diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 148b3e7786..8b0d56eb93 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1108,7 +1108,10 @@ bool BufferView::dispatch(FuncRequest const & cmd) break; case LFUN_WORD_FIND: - find(this, cmd); + if (find(this, cmd)) + showCursor(); + else + message(_("String not found!")); break; case LFUN_WORD_REPLACE: { diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 8406c77193..1a214589fb 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -244,10 +244,10 @@ 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 << endl; @@ -261,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); } diff --git a/src/lyxfind.h b/src/lyxfind.h index d23be0fec6..6301ab5b74 100644 --- a/src/lyxfind.h +++ b/src/lyxfind.h @@ -45,8 +45,9 @@ docstring const replace2string(docstring const & search, /** Parse the string encoding of the find request that is found in * \c ev.argument and act on it. * The string is encoded by \c find2string. + * \return true if the string was found. */ -void find(BufferView * bv, FuncRequest const & ev); +bool find(BufferView * bv, FuncRequest const & ev); /** Parse the string encoding of the replace request that is found in * \c ev.argument and act on it.