diff -r 6dc0a20031f7 -r 1b4d1ea6ea8c vymmodel.cpp --- a/vymmodel.cpp Wed Feb 04 16:33:16 2009 +0000 +++ b/vymmodel.cpp Fri Mar 06 15:02:58 2009 +0000 @@ -125,7 +125,8 @@ selModel=NULL; // find routine - itFind=NULL; + findCurrent=NULL; + findPrevious=NULL; EOFind=false; // animations @@ -1490,33 +1491,38 @@ } } -BranchObj* VymModel::findText (QString s, bool cs) // FIXME needs to converted to first() next() next (ti) +BranchObj* VymModel::findText (QString s, bool cs) { - /* + int d=0; QTextDocument::FindFlags flags=0; if (cs) flags=QTextDocument::FindCaseSensitively; - if (!itFind) + if (!findCurrent) { // Nothing found or new find process if (EOFind) // nothing found, start again EOFind=false; - itFind=first(); + findCurrent=NULL; + findPrevious=NULL; + next (findCurrent,findPrevious,d); } bool searching=true; bool foundNote=false; while (searching && !EOFind) { - if (itFind) + if (findCurrent) { // Searching in Note - if (itFind->getNote().contains(s,cs)) + if (findCurrent->getNote().contains(s,cs)) { + select (findCurrent); + /* if (getSelectedBranch()!=itFind) { select(itFind); ensureSelectionVisible(); } + */ if (textEditor->findText(s,flags)) { searching=false; @@ -1524,17 +1530,16 @@ } } // Searching in Heading - if (searching && itFind->getHeading().contains (s,cs) ) + if (searching && findCurrent->getHeading().contains (s,cs) ) { - select(itFind); - ensureSelectionVisible(); + select(findCurrent); searching=false; } } if (!foundNote) { - itFind=next(itFind); - if (!itFind) EOFind=true; + if (!next(findCurrent,findPrevious,d) ) + EOFind=true; } //cout <<"still searching... "<getHeading())<