]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfind.C
adjust to be able to complile with gcc 3.0, put selection vars into own struct, remov...
[lyx.git] / src / lyxfind.C
index 21065b6115f8a3292ef02309267f8e1f404317b6..0098c0ff048f204a985e0db554e197cdad3bb35a 100644 (file)
@@ -86,9 +86,9 @@ bool LyXFind(BufferView * bv,
    bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR);
    
    LyXText * ltCur = bv->text;
-   if (ltCur->selection)
-     ltCur->cursor = forward ? ltCur->sel_end_cursor
-     : ltCur->sel_start_cursor;
+   if (ltCur->selection.set())
+     ltCur->cursor = forward ? ltCur->selection.end
+            : ltCur->selection.start;
 
    if (forward 
        ? SearchForward(bv, searchstr, casesens, matchwrd)
@@ -118,11 +118,7 @@ bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos,
    
        string::size_type size = str.length();
        LyXParagraph::size_type i = 0;
-#ifndef NEW_INSETS
-       while (((pos + i) < par->Last())
-#else
        while (((pos + i) < par->size())
-#endif
               && (string::size_type(i) < size)
               && (cs ? (str[i] == par->GetChar(pos + i))
                   : (toupper(str[i]) == toupper(par->GetChar(pos + i)))))
@@ -133,11 +129,7 @@ bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos,
          // if necessary, check whether string matches word
          if (!mw || 
              (mw && ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos - 1)))
-#ifndef NEW_INSETS
-                     && (pos + size >= par->Last()
-#else
                      && (pos + size >= par->size()
-#endif
                          || !IsLetterCharOrDigit(par->GetChar(pos + size))))
               )
              )
@@ -156,11 +148,7 @@ bool SearchForward(BufferView * bv, string const & str,
        LyXParagraph::size_type pos = bv->text->cursor.pos();
    
        while (par && !IsStringInText(par, pos, str, cs, mw)) {
-#ifndef NEW_INSETS
-               if (pos < par->Last() - 1)
-#else
                if (pos < par->size() - 1)
-#endif
                        ++pos;
                else {
                        pos = 0;
@@ -193,11 +181,7 @@ bool SearchBackward(BufferView * bv, string const & str,
                        do {
                                par = par->previous();
                                if (par)
-#ifndef NEW_INSETS
-                                       pos = par->Last() - 1;
-#else
                                        pos = par->size() - 1;
-#endif
                        } while (par && pos < 0);
                }
        } while (par && !IsStringInText(par, pos, str, cs, mw));