commit 567d0e8fb4f42cefbce03487b57d51f17ed042cf
Author: Kornel Benko <[email protected]>
Date: Thu May 26 17:17:49 2022 +0200
FindAdv: Amend 652ffc9c: have to check inTexted() before using Paragraph
---
src/lyxfind.cpp | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index 83bb13a..25b2d29 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -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);
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs