{
FuncStatus flag;
+ Cursor & cur = cursor_;
+
switch (cmd.action) {
case LFUN_UNDO:
case LFUN_FILE_INSERT_PLAINTEXT:
case LFUN_BOOKMARK_SAVE:
// FIXME: Actually, these LFUNS should be moved to Text
- flag.enabled(cursor_.inTexted());
+ flag.enabled(cur.inTexted());
break;
case LFUN_FONT_STATE:
case LFUN_LABEL_INSERT:
case LFUN_NOTE_NEXT:
case LFUN_REFERENCE_NEXT:
case LFUN_WORD_FIND:
- case LFUN_WORD_REPLACE:
case LFUN_MARK_OFF:
case LFUN_MARK_ON:
case LFUN_MARK_TOGGLE:
flag.enabled(true);
break;
+ case LFUN_WORD_REPLACE:
+ flag.enabled(!cur.paragraph().isDeleted(cur.pos()));
+ break;
+
case LFUN_LABEL_GOTO: {
flag.enabled(!cmd.argument().empty()
- || getInsetByCode<InsetRef>(cursor_, Inset::REF_CODE));
+ || getInsetByCode<InsetRef>(cur, Inset::REF_CODE));
break;
}
FileDialog fileDlg(_("Select LyX document to insert"),
LFUN_FILE_INSERT,
make_pair(_("Documents|#o#O"), from_utf8(lyxrc.document_path)),
- make_pair(_("Examples|#E#e"), from_utf8(addPath(package().system_support().absFilename(), "examples"))));
+ make_pair(_("Examples|#E#e"),
+ from_utf8(addPath(package().system_support().absFilename(),
+ "examples"))));
FileDialog::Result result =
fileDlg.open(from_utf8(initpath),
{}
// returns true if the specified string is at the specified position
- bool operator()(Paragraph const & par, pos_type pos) const
+ // del specifies whether deleted strings in ct mode will be considered
+ bool operator()(Paragraph const & par, pos_type pos, bool del = true) const
{
docstring::size_type const size = str.length();
pos_type i = 0;
break;
if (!cs && uppercase(str[i]) != uppercase(par.getChar(pos + i)))
break;
+ if (!del && par.isDeleted(pos + i))
+ break;
}
if (size != docstring::size_type(i))
};
-bool findForward(DocIterator & cur, MatchString const & match)
+bool findForward(DocIterator & cur, MatchString const & match,
+ bool find_del = true)
{
for (; cur; cur.forwardChar())
- if (cur.inTexted() && match(cur.paragraph(), cur.pos()))
+ if (cur.inTexted() &&
+ match(cur.paragraph(), cur.pos(), find_del))
return true;
return false;
}
-bool findBackwards(DocIterator & cur, MatchString const & match)
+bool findBackwards(DocIterator & cur, MatchString const & match,
+ bool find_del = true)
{
while (cur) {
cur.backwardChar();
- if (cur.inTexted() && match(cur.paragraph(), cur.pos()))
+ if (cur.inTexted() &&
+ match(cur.paragraph(), cur.pos(), find_del))
return true;
}
return false;
}
-bool find(BufferView * bv, docstring const & searchstr, bool cs, bool mw, bool fw)
+bool find(BufferView * bv, docstring const & searchstr, bool cs, bool mw, bool fw,
+ bool find_del = true)
{
if (!searchAllowed(bv, searchstr))
return false;
MatchString const match(searchstr, cs, mw);
- bool found = fw ? findForward(cur, match) : findBackwards(cur, match);
+ bool found = fw ? findForward(cur, match, find_del) :
+ findBackwards(cur, match, find_del);
if (found)
bv->putSelectionAt(cur, searchstr.length(), !fw);
int const ssize = searchstr.size();
DocIterator cur = doc_iterator_begin(buf.inset());
- while (findForward(cur, match)) {
+ while (findForward(cur, match, false)) {
pos_type pos = cur.pos();
Font const font
= cur.paragraph().getFontSettings(buf.params(), pos);
Cursor & cur = bv->cursor();
cap::replaceSelectionWithString(cur, replacestr, fw);
bv->buffer()->markDirty();
- find(bv, searchstr, cs, mw, fw);
+ find(bv, searchstr, cs, mw, fw, false);
bv->update();
return 1;