mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 22:17:41 +00:00
Applying (variation of) fix by stwitt to solve #7172.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37043 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4d367ac00a
commit
fab8c264aa
@ -330,11 +330,11 @@ void FindAndReplaceWidget::findAndReplaceScope(FindAndReplaceOptions & opt)
|
||||
dispatch(cmd);
|
||||
LYXERR(Debug::FIND, "dispatched");
|
||||
if (bv->cursor().result().dispatched()) {
|
||||
// Match found, selected and replaced if needed
|
||||
// New match found and selected (old selection replaced if needed)
|
||||
return;
|
||||
}
|
||||
|
||||
// No match found in current buffer:
|
||||
// No match found in current buffer (however old selection might have been replaced)
|
||||
// select next buffer in scope, if any
|
||||
bool prompt = nextPrevBuffer(buf, opt);
|
||||
if (prompt) {
|
||||
@ -367,6 +367,9 @@ void FindAndReplaceWidget::findAndReplaceScope(FindAndReplaceOptions & opt)
|
||||
lyx::dispatch(FuncRequest(LFUN_BUFFER_SWITCH,
|
||||
buf_orig->absFileName()));
|
||||
bv = view_.documentBufferView();
|
||||
// This may happen after a replace occurred
|
||||
if (cur_orig.pos() > cur_orig.lastpos())
|
||||
cur_orig.pos() = cur_orig.lastpos();
|
||||
bv->cursor().setCursor(cur_orig);
|
||||
}
|
||||
|
||||
|
@ -1203,9 +1203,11 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M
|
||||
cap::cutSelection(cur, false, false);
|
||||
if (!cur.inMathed()) {
|
||||
LYXERR(Debug::FIND, "Replacing by pasteParagraphList()ing repl_buffer");
|
||||
LYXERR(Debug::FIND, "Before pasteParagraphList() cur=" << cur << endl);
|
||||
cap::pasteParagraphList(cur, repl_buffer.paragraphs(),
|
||||
repl_buffer.params().documentClassPtr(),
|
||||
bv->buffer().errorList("Paste"));
|
||||
LYXERR(Debug::FIND, "After pasteParagraphList() cur=" << cur << endl);
|
||||
} else {
|
||||
odocstringstream ods;
|
||||
OutputParams runparams(&repl_buffer.params().encoding());
|
||||
@ -1226,6 +1228,7 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M
|
||||
cur.niceInsert(repl_latex);
|
||||
}
|
||||
cur.pos() -= repl_buffer.paragraphs().begin()->size();
|
||||
LYXERR(Debug::FIND, "Putting selection at cur=" << cur << " with len: " << repl_buffer.paragraphs().begin()->size());
|
||||
bv->putSelectionAt(DocIterator(cur), repl_buffer.paragraphs().begin()->size(), !opt.forward);
|
||||
bv->processUpdateFlags(Update::Force);
|
||||
}
|
||||
@ -1235,7 +1238,7 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M
|
||||
bool findAdv(BufferView * bv, FindAndReplaceOptions const & opt)
|
||||
{
|
||||
DocIterator cur;
|
||||
int match_len;
|
||||
int match_len = 0;
|
||||
|
||||
if (opt.search.empty()) {
|
||||
bv->message(_("Search text is empty!"));
|
||||
|
Loading…
Reference in New Issue
Block a user