commit 46c573c082f2428f6884ba3f773c34a846cf3557
Author: Kornel Benko <[email protected]>
Date:   Sun May 29 14:12:38 2022 +0200

    FindAdv: Use modified check to determine if char is a word-char.
    
    Amends 652ffc9c(3)
---
 src/lyxfind.cpp |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index 594e2aa..7fadd51 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -4864,14 +4864,17 @@ bool findAdv(BufferView * bv, FindAndReplaceOptions & 
opt)
                        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 (!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();
+                                       int len_limit, new_pos;
+                                       if (cur.lastpos() < par.size())
+                                               len_limit = cur.lastpos();
+                                       else
+                                               len_limit = par.size();
+                                       for (new_pos = cur.pos() - 1; new_pos < 
len_limit; new_pos++) {
+                                               if 
(!isWordChar(par.getChar(new_pos)))
+                                                       break;
                                        }
+                                       if (new_pos > cur.pos())
+                                               cur.pos() = new_pos;
                                }
                                else if (cur.inMathed()) {
                                        // Check if 'cur.pos()-1' and 
'cur.pos()' both point to a letter,
@@ -4898,7 +4901,6 @@ bool findAdv(BufferView * bv, FindAndReplaceOptions & opt)
                                                if (len > 1)
                                                        cur.pos() = cur.pos() + 
len - 1;
                                        }
-       
                                }
                                opt.matchword = false;
                        }
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to