]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfind.C
explain why ownsClipbiard() does not work on Windows and OS X
[lyx.git] / src / lyxfind.C
index 99181a4c09dc280cb0f36539cd8c12d2b7e69494..6de16909773e118d97bbaec8b46ef4e595286122 100644 (file)
@@ -35,7 +35,7 @@
 
 namespace lyx {
 
-using support::lowercase;
+using support::compare_no_case;
 using support::uppercase;
 using support::split;
 
@@ -206,7 +206,7 @@ bool stringSelected(BufferView * bv, docstring const & searchstr,
        // string search and select next occurance and return
        docstring const & str1 = searchstr;
        docstring const str2 = bv->cursor().selectionAsString(false);
-       if ((cs && str1 != str2) || lowercase(str1) != lowercase(str2)) {
+       if ((cs && str1 != str2) || compare_no_case(str1, str2) != 0) {
                find(bv, searchstr, cs, mw, fw);
                return false;
        }
@@ -347,18 +347,24 @@ bool findNextChange(BufferView * bv)
        Change orig_change = cur.paragraph().lookupChange(cur.pos());
 
        DocIterator et = doc_iterator_end(cur.inset());
+       DocIterator ok = cur;   // see below
        for (; cur != et; cur.forwardPosNoDescend()) {
+               ok = cur;
                Change change = cur.paragraph().lookupChange(cur.pos());
                if (change != orig_change) {
                        break;
                }
        }
+
+       // avoid crash (assertion violation) if the imaginary end-of-par
+       // character of the last paragraph of the document is marked as changed 
+       if (cur == et) {
+               cur = ok;
+       }
+
        // Now put cursor to end of selection:
        bv->cursor().setCursor(cur);
        bv->cursor().setSelection();
-       // if we used a lfun like in find/replace, dispatch would do
-       // that for us
-       bv->update();
 
        return true;
 }