mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
FindAdv: Amend 652ffc9c
: have to check inTexted() before using Paragraph
This commit is contained in:
parent
1ef1808c93
commit
567d0e8fb4
@ -4857,16 +4857,21 @@ bool findAdv(BufferView * bv, FindAndReplaceOptions & opt)
|
||||
num_replaced += findAdvReplace(bv, opt, matchAdv);
|
||||
cur = bv->cursor();
|
||||
if (opt.forward) {
|
||||
if (opt.matchword) { // Skip word-characters if we are in the mid of a word
|
||||
Paragraph const & par = cur.paragraph();
|
||||
if ((cur.pos() > 0) && !par.isWordSeparator(cur.pos() -1, true)) {
|
||||
while (cur.pos() < par.size()) {
|
||||
if (par.isWordSeparator(cur.pos(), true))
|
||||
break;
|
||||
else
|
||||
cur.forwardPos();
|
||||
if (opt.matchword && cur.pos() > 0) { // Skip word-characters if we are in the mid of a word
|
||||
if (cur.inTexted()) {
|
||||
Paragraph const & par = cur.paragraph();
|
||||
if ((cur.pos() > 0) && !par.isWordSeparator(cur.pos() -1, true)) {
|
||||
class Text *t = cur.text();
|
||||
CursorSlice to;
|
||||
CursorSlice from = cur.top();
|
||||
t->getWord(from, to, WHOLE_WORD);
|
||||
cur.pos() = to.pos();
|
||||
cur.pit() = to.pit();
|
||||
}
|
||||
}
|
||||
else if (cur.inMathed()) {
|
||||
cur.pos() = cur.lastpos();
|
||||
}
|
||||
opt.matchword = false;
|
||||
}
|
||||
pos_len = findForwardAdv(cur, matchAdv);
|
||||
|
Loading…
Reference in New Issue
Block a user