idea what a mess this was.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35639
a592a061-630c-0410-9148-
cb99ea01b6c8
bool const fw = act == LFUN_WORD_FIND_FORWARD;
docstring const data =
find2string(searched_string, true, false, fw);
bool const fw = act == LFUN_WORD_FIND_FORWARD;
docstring const data =
find2string(searched_string, true, false, fw);
- find(this, FuncRequest(LFUN_WORD_FIND, data));
+ bool found = lyxfind(this, FuncRequest(LFUN_WORD_FIND, data));
+ if (found)
+ dr.screenUpdate(Update::Force | Update::FitCursor);
lyx::dispatch(FuncRequest(LFUN_DIALOG_SHOW, "findreplace"));
break;
}
lyx::dispatch(FuncRequest(LFUN_DIALOG_SHOW, "findreplace"));
break;
}
- if (find(this, req))
- showCursor();
+ if (lyxfind(this, req))
+ dr.screenUpdate(Update::Force | Update::FitCursor);
else
message(_("String not found!"));
d->search_request_cache_ = req;
else
message(_("String not found!"));
d->search_request_cache_ = req;
- replace(this, cmd, has_deleted);
- dr.forceBufferUpdate();
+ if (lyxreplace(this, cmd, has_deleted)) {
+ dr.forceBufferUpdate();
+ dr.screenUpdate(Update::Force | Update::FitCursor);
+ }
cap::replaceSelectionWithString(cur, replacestr, forward);
bv->buffer().markDirty();
findOne(bv, searchstr, case_sens, whole, forward, false);
cap::replaceSelectionWithString(cur, replacestr, forward);
bv->buffer().markDirty();
findOne(bv, searchstr, case_sens, whole, forward, false);
- bv->buffer().updateMacros();
- bv->processUpdateFlags(Update::Force | Update::FitCursor);
-bool find(BufferView * bv, FuncRequest const & ev)
+bool lyxfind(BufferView * bv, FuncRequest const & ev)
{
if (!bv || ev.action() != LFUN_WORD_FIND)
return false;
{
if (!bv || ev.action() != LFUN_WORD_FIND)
return false;
-void replace(BufferView * bv, FuncRequest const & ev, bool has_deleted)
+bool lyxreplace(BufferView * bv, FuncRequest const & ev, bool has_deleted)
{
if (!bv || ev.action() != LFUN_WORD_REPLACE)
{
if (!bv || ev.action() != LFUN_WORD_REPLACE)
+ // assume we didn't do anything
+ bool retval = false;
+
// data is of the form
// "<search>
// <replace>
// data is of the form
// "<search>
// <replace>
// emit message signal.
buf.message(_("String not found!"));
} else {
// emit message signal.
buf.message(_("String not found!"));
} else {
if (replace_count == 1) {
// emit message signal.
buf.message(_("String has been replaced."));
} else {
if (replace_count == 1) {
// emit message signal.
buf.message(_("String has been replaced."));
} else {
- docstring str = convert<docstring>(replace_count);
- str += _(" strings have been replaced.");
+ docstring str = bformat(_("%1$d strings have been replaced."), replace_count);
// emit message signal.
buf.message(str);
}
// emit message signal.
buf.message(str);
}
// if we have deleted characters, we do not replace at all, but
// rather search for the next occurence
if (findOne(bv, search, casesensitive, matchword, forward))
// if we have deleted characters, we do not replace at all, but
// rather search for the next occurence
if (findOne(bv, search, casesensitive, matchword, forward))
else
bv->message(_("String not found!"));
}
else
bv->message(_("String not found!"));
}
* The string is encoded by \c find2string.
* \return true if the string was found.
*/
* The string is encoded by \c find2string.
* \return true if the string was found.
*/
-bool find(BufferView * bv, FuncRequest const & ev);
+bool lyxfind(BufferView * bv, FuncRequest const & ev);
/** 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.
/** 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.
+ * \return whether we did anything
-void replace(BufferView * bv, FuncRequest const &, bool has_deleted = false);
+bool lyxreplace(BufferView * bv, FuncRequest const &, bool has_deleted = false);
/// find the next change in the buffer
bool findNextChange(BufferView * bv);
/// find the next change in the buffer
bool findNextChange(BufferView * bv);