]> 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 a556a491732852fdd07a41f32d32359147b2660a..82c8728656f22a2fcbee4fd46687f0939ca5a54c 100644 (file)
@@ -285,7 +285,7 @@ docstring const replace2string(docstring const & replace,
 
 bool find(BufferView * bv, FuncRequest const & ev)
 {
-       if (!bv || ev.action_ != LFUN_WORD_FIND)
+       if (!bv || ev.action() != LFUN_WORD_FIND)
                return false;
 
        //lyxerr << "find called, cmd: " << ev << endl;
@@ -306,7 +306,7 @@ bool find(BufferView * bv, FuncRequest const & ev)
 
 void replace(BufferView * bv, FuncRequest const & ev, bool has_deleted)
 {
-       if (!bv || ev.action_ != LFUN_WORD_REPLACE)
+       if (!bv || ev.action() != LFUN_WORD_REPLACE)
                return;
 
        // data is of the form
@@ -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;