findPreviousMatch(cursorPosition) {
		for (let i = this.matches.length - 1; i >= 0; i--) {
			if (this.matches[i].index < cursorPosition) {
				return i;
			}
		}
		// If there are no matches before the cursor position, return -1
		return -1;
	}
Finds the index of the previous match before the given cursor position.

@param {number} cursorPosition - The current cursor position.
@returns {number} - The index in the matches array or -1 if not found.