]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfind.cpp
GuiBox.cpp: fix this issue: horizontal box alignment is only possible without inner...
[lyx.git] / src / lyxfind.cpp
index 5e44691ad5d062a66e4452d964ea9513e8363189..82c8728656f22a2fcbee4fd46687f0939ca5a54c 100644 (file)
@@ -371,7 +371,7 @@ bool findChange(BufferView * bv, bool next)
        if (bv->cursor().selection()) {
                // set the cursor at the beginning or at the end of the selection
                // before searching. Otherwise, the current change will be found.
-               if (next != (bv->cursor().top() > bv->cursor().anchor()))
+               if (next != (bv->cursor().top() > bv->cursor().normalAnchor()))
                        bv->cursor().setCursorToAnchor();
        }
 
@@ -983,11 +983,11 @@ int findForwardAdv(DocIterator & cur, MatchStringAdv & match)
 
 
 /// Find the most backward consecutive match within same paragraph while searching backwards.
-void findMostBackwards(DocIterator & cur, MatchStringAdv const & match, int & len)
+int findMostBackwards(DocIterator & cur, MatchStringAdv const & match)
 {
        DocIterator cur_begin = doc_iterator_begin(cur.buffer());
        DocIterator tmp_cur = cur;
-       len = findAdvFinalize(tmp_cur, match);
+       int len = findAdvFinalize(tmp_cur, match);
        Inset & inset = cur.inset();
        for (; cur != cur_begin; cur.backwardPos()) {
                LYXERR(Debug::FIND, "findMostBackwards(): cur=" << cur);
@@ -1001,6 +1001,7 @@ void findMostBackwards(DocIterator & cur, MatchStringAdv const & match, int & le
                len = new_len;
        }
        LYXERR(Debug::FIND, "findMostBackwards(): exiting with cur=" << cur);
+       return len;
 }
 
 
@@ -1032,11 +1033,9 @@ int findBackwardsAdv(DocIterator & cur, MatchStringAdv & match) {
                                found_match = match(cur);
                                LYXERR(Debug::FIND, "findBackAdv3: found_match=" 
                                       << found_match << ", cur: " << cur);
-                               if (found_match) {
-                                       int len;
-                                       findMostBackwards(cur, match, len);
-                                       return len;
-                               }
+                               if (found_match)
+                                       return findMostBackwards(cur, match);
+
                                // Stop if begin of document reached
                                if (cur == cur_begin)
                                        break;