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);
|
dispatch(cmd);
|
||||||
LYXERR(Debug::FIND, "dispatched");
|
LYXERR(Debug::FIND, "dispatched");
|
||||||
if (bv->cursor().result().dispatched()) {
|
if (bv->cursor().result().dispatched()) {
|
||||||
// Match found, selected and replaced if needed
|
// New match found and selected (old selection replaced if needed)
|
||||||
return;
|
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
|
// select next buffer in scope, if any
|
||||||
bool prompt = nextPrevBuffer(buf, opt);
|
bool prompt = nextPrevBuffer(buf, opt);
|
||||||
if (prompt) {
|
if (prompt) {
|
||||||
@ -367,6 +367,9 @@ void FindAndReplaceWidget::findAndReplaceScope(FindAndReplaceOptions & opt)
|
|||||||
lyx::dispatch(FuncRequest(LFUN_BUFFER_SWITCH,
|
lyx::dispatch(FuncRequest(LFUN_BUFFER_SWITCH,
|
||||||
buf_orig->absFileName()));
|
buf_orig->absFileName()));
|
||||||
bv = view_.documentBufferView();
|
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);
|
bv->cursor().setCursor(cur_orig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1203,9 +1203,11 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M
|
|||||||
cap::cutSelection(cur, false, false);
|
cap::cutSelection(cur, false, false);
|
||||||
if (!cur.inMathed()) {
|
if (!cur.inMathed()) {
|
||||||
LYXERR(Debug::FIND, "Replacing by pasteParagraphList()ing repl_buffer");
|
LYXERR(Debug::FIND, "Replacing by pasteParagraphList()ing repl_buffer");
|
||||||
|
LYXERR(Debug::FIND, "Before pasteParagraphList() cur=" << cur << endl);
|
||||||
cap::pasteParagraphList(cur, repl_buffer.paragraphs(),
|
cap::pasteParagraphList(cur, repl_buffer.paragraphs(),
|
||||||
repl_buffer.params().documentClassPtr(),
|
repl_buffer.params().documentClassPtr(),
|
||||||
bv->buffer().errorList("Paste"));
|
bv->buffer().errorList("Paste"));
|
||||||
|
LYXERR(Debug::FIND, "After pasteParagraphList() cur=" << cur << endl);
|
||||||
} else {
|
} else {
|
||||||
odocstringstream ods;
|
odocstringstream ods;
|
||||||
OutputParams runparams(&repl_buffer.params().encoding());
|
OutputParams runparams(&repl_buffer.params().encoding());
|
||||||
@ -1226,6 +1228,7 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M
|
|||||||
cur.niceInsert(repl_latex);
|
cur.niceInsert(repl_latex);
|
||||||
}
|
}
|
||||||
cur.pos() -= repl_buffer.paragraphs().begin()->size();
|
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->putSelectionAt(DocIterator(cur), repl_buffer.paragraphs().begin()->size(), !opt.forward);
|
||||||
bv->processUpdateFlags(Update::Force);
|
bv->processUpdateFlags(Update::Force);
|
||||||
}
|
}
|
||||||
@ -1235,7 +1238,7 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M
|
|||||||
bool findAdv(BufferView * bv, FindAndReplaceOptions const & opt)
|
bool findAdv(BufferView * bv, FindAndReplaceOptions const & opt)
|
||||||
{
|
{
|
||||||
DocIterator cur;
|
DocIterator cur;
|
||||||
int match_len;
|
int match_len = 0;
|
||||||
|
|
||||||
if (opt.search.empty()) {
|
if (opt.search.empty()) {
|
||||||
bv->message(_("Search text is empty!"));
|
bv->message(_("Search text is empty!"));
|
||||||
|
Loading…
Reference in New Issue
Block a user