Uploaded image for project: 'BlueJ'
  1. BlueJ
  2. BLUEJ-230

Find incorrectly says "String XYZ not found" when XYZ is at the beginning of the document

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Done
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.0.6
    • Component/s: Editor

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              mik Michael K├Âlling
              Reporter:
              davmac Davin McCall
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: