if (searched_string.empty())
break;
- bool const fw = act == LFUN_WORD_FIND_FORWARD;
+ bool casesensitive;
+ bool matchword;
+ bool forward;
+ docstring const search = string2find(searched_string, casesensitive, matchword, forward);
docstring const data =
- find2string(searched_string, true, false, fw);
+ find2string(search, casesensitive, matchword, act == LFUN_WORD_FIND_FORWARD);
bool found = lyxfind(this, FuncRequest(LFUN_WORD_FIND, data));
if (found)
dr.screenUpdate(Update::Force | Update::FitCursor);
}
-bool lyxfind(BufferView * bv, FuncRequest const & ev)
+docstring const string2find(docstring const & argument,
+ bool &casesensitive,
+ bool &matchword,
+ bool &forward)
{
- if (!bv || ev.action() != LFUN_WORD_FIND)
- return false;
-
- //lyxerr << "find called, cmd: " << ev << endl;
-
// data is of the form
// "<search>
// <casesensitive> <matchword> <forward>"
docstring search;
- docstring howto = split(ev.argument(), search, '\n');
+ docstring howto = split(argument, search, '\n');
- bool casesensitive = parse_bool(howto);
- bool matchword = parse_bool(howto);
- bool forward = parse_bool(howto);
+ casesensitive = parse_bool(howto);
+ matchword = parse_bool(howto);
+ forward = parse_bool(howto);
+
+ return search;
+}
+
+
+bool lyxfind(BufferView * bv, FuncRequest const & ev)
+{
+ if (!bv || ev.action() != LFUN_WORD_FIND)
+ return false;
+
+ //lyxerr << "find called, cmd: " << ev << endl;
+ bool casesensitive;
+ bool matchword;
+ bool forward;
+ docstring search = string2find(ev.argument(), casesensitive, matchword, forward);
return findOne(bv, search, casesensitive, matchword, forward, false, true);
}
class DocIterator;
class FuncRequest;
+/** Decode the \c argument to extract search plus options from a string
+ * that came to the LyX core in a FuncRequest wrapper.
+ */
+docstring const string2find(docstring const & argument,
+ bool &casesensitive,
+ bool &matchword,
+ bool &forward);
+
/** Encode the parameters needed to find \c search as a string
* that can be dispatched to the LyX core in a FuncRequest wrapper.
*/