]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfind.C
and this
[lyx.git] / src / lyxfind.C
index bca895c00274c176f472a32720d66621f74d82d7..7592ca73445f4965fec7393ba2001c52638e4472 100644 (file)
 #include "frontends/Alert.h"
 #include "frontends/LyXView.h"
 
-#include "support/textutils.h"
 #include "support/tostr.h"
 
-#include "support/std_sstream.h"
+#include <sstream>
 
 using lyx::support::lowercase;
 using lyx::support::uppercase;
@@ -86,10 +85,10 @@ public:
 
                // if necessary, check whether string matches word
                if (mw) {
-                       if (pos > 0 && IsLetterCharOrDigit(par.getChar(pos - 1)))
+                       if (pos > 0 && par.isWord(pos - 1))
                                return false;
                        if (pos + lyx::pos_type(size) < parsize
-                                       && IsLetterCharOrDigit(par.getChar(pos + size)));
+                           && par.isWord(pos + size));
                                return false;
                }
 
@@ -117,9 +116,11 @@ bool findForward(DocIterator & cur, MatchString const & match)
 
 bool findBackwards(DocIterator & cur, MatchString const & match)
 {
-       for (; cur; cur.backwardChar())
+       while (cur) {
+               cur.backwardChar();
                if (cur.inTexted() && match(cur.paragraph(), cur.pos()))
                        return true;
+       }
        return false;
 }
 
@@ -217,7 +218,7 @@ bool stringSelected(BufferView * bv, string const & searchstr,
 
 
 int replace(BufferView * bv, string const & searchstr,
-      string const & replacestr, bool cs, bool mw, bool fw)
+           string const & replacestr, bool cs, bool mw, bool fw)
 {
        if (!searchAllowed(bv, searchstr) || bv->buffer()->isReadonly())
                return 0;
@@ -344,10 +345,10 @@ bool findNextChange(BufferView * bv)
                return false;
 
        Paragraph const & par = cur.paragraph();
-       pos_type pos = cur.pos();
+       const pos_type pos = cur.pos();
 
        Change orig_change = par.lookupChangeFull(pos);
-       pos_type parsize = par.size();
+       const pos_type parsize = par.size();
        pos_type end = pos;
 
        for (; end != parsize; ++end) {
@@ -361,11 +362,10 @@ bool findNextChange(BufferView * bv)
                }
        }
        pos_type length = end - pos;
-       bv->putSelectionAt(cur, length, true);
+       bv->putSelectionAt(cur, length, false);
+
        return true;
 }
 
 } // find namespace
 } // lyx namespace
-
-