Fixed issue #8543 also for advanced search (cursor moved at proper end of selection before starting Find Advanced operation).

This commit is contained in:
Tommaso Cucinotta 2013-04-04 00:43:36 +01:00
parent 6d4cde435d
commit 5e5115c376

View File

@ -1445,6 +1445,14 @@ bool findAdv(BufferView * bv, FindAndReplaceOptions const & opt)
try { try {
MatchStringAdv matchAdv(bv->buffer(), opt); MatchStringAdv matchAdv(bv->buffer(), opt);
int length = bv->cursor().selectionEnd().pos() - bv->cursor().selectionBegin().pos();
if (length > 0) {
LYXERR(Debug::FIND, "Putting selection at cur=" << cur << " with length: " << length << " and direction: " << !opt.forward);
if (opt.forward)
bv->putSelectionAt(bv->cursor().selectionBegin(), length, false);
else
bv->putSelectionAt(bv->cursor().selectionBegin(), length, true);
}
findAdvReplace(bv, opt, matchAdv); findAdvReplace(bv, opt, matchAdv);
cur = bv->cursor(); cur = bv->cursor();
if (opt.forward) if (opt.forward)