private IntRange scanForwards(String text, int pos, char openChar, char closeChar) {
		int start = pos;
		int end;
		int open;
		int close;
		int balance = 1;
		do {
			open = text.indexOf(openChar, pos + 1);
			close = text.indexOf(closeChar, pos + 1);

			if (open != -1 && open < close) {
				balance++;
				pos = open;
			} else if (close != -1 && close > pos) {
				balance--;
				pos = close;

				// Balance solved
				if (balance == 0) {
					end = pos;
					break;
				}
			} else {
				// Neither an open nor close character was found.
				// The balance is not resolved, no match.
				return null;
			}
		} while (true);

		// End found? Create range.
		return (end > 0) ? new IntRange(start, end) : null;
	}
@param paragraph
		Paragraph index, which is {@code line - 1}.

@return {@code true} when the line belongs to the {@link #getRange() selected bracket pair range}.
recaf-ui/src/main/java/software/coley/recaf/ui/control/richtext/bracket/SelectedBracketTracking.java