Attach (recommended) or Link to PDF file here:
[NHA-20211231-A-018_before.pdf](https://github.com/mozilla/pdf.js/files/8055863/NHA-20211231-A-018_before.pdf)

Configuration:
- Web browser and its version: Firefox nightly
- Operating system and its version: Windows 11

Steps to reproduce the problem:
1. Search for "a"
2. Some highlighter results are wrong

![image](https://user-images.githubusercontent.com/5641725/153760070-61708a75-524c-4a21-bc1f-7745e9151b97.png)

After investigations some results are shifted because of a bug with "-\n".
2}[ ]*`;
        }
        if (p3) {
          
          return "[ ]+";
        }
        if (matchDiacritics) {
          return p4 || p5;
        }
        if (p4) {
          
          return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : "";
        }
        
        
        if (hasDiacritics) {
          isUnicode = true;
          return `${p5}\\p{M}*`;
        }
        return p5;
      }
    );
    const trailingSpaces = "[ ]*";
    if (query.endsWith(trailingSpaces)) {
      
      
      
      query = query.slice(0, query.length - trailingSpaces.length);
    }
    if (matchDiacritics) {
      
      if (hasDiacritics) {
        isUnicode = true;
        query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\p{M}]|$)`;
      }
    }
    return [isUnicode, query];
  }
  _calculateMatch(pageIndex) {
    let query = this._query;
    if (query.length === 0) {
      
      return;
    }
    const { caseSensitive, entireWord, phraseSearch } = this._state;
    const pageContent = this._pageContents[pageIndex];
    const hasDiacritics = this._hasDiacritics[pageIndex];
    let isUnicode = false;
    if (phraseSearch) {
      [isUnicode, query] = this._convertToRegExpString(query, hasDiacritics);
    } else {
      
      
      const match = query.match(\S+g);
      if (match) {
        query = match
          .sort()
          .reverse()
          .map(q => {
            const [isUnicodePart, queryPart] = this._convertToRegExpString(
              q,
              hasDiacritics
            );
            isUnicode ||= isUnicodePart;
            return `(${queryPart})`;
          })
          .join("|");
      }
    }
    const flags = `g${isUnicode ? "u" : ""}${caseSensitive ? "" : "i"}`;
    query = new RegExp(query, flags);
    this._calculateRegExpMatch(query, entireWord, pageIndex, pageContent);
    
    
    if (this._state.highlightAll) {
      this._updatePage(pageIndex);
    }
    if (this._resumePageIdx === pageIndex) {
      this._resumePageIdx = n