Find incorrectly says "String XYZ not found" when XYZ is at the very beginning of the document. More generally: the count of found matches is short by one if one of the matches is at the very beginning.
This is due to MoeEditor.getNumHighlights() returning the wrong value, because isHighlight() always returns false if the startPos argument is 0 (because the array which is passed in at the beginning has its elements initialized to 0).
More generally though:
- Actually counting the highlights after doing a search to determine the number of occurrences seems wrong. Why not just count the occurrences during the search? (e.g. return the number from doFindSelect()).
- highlightAll() only ever gets called with wholeWord==false and select==true. To simplify the code, these parameters should be removed. Likewise for the search() and doFindSelect() methods as appropriate.
- doFindSelect() uses two separate highlights for each found occurrence
- one for the background and one for the border. This seems a bit messy. It would be better to have a HighlightPainter which drew both, I think.