-
Notifications
You must be signed in to change notification settings - Fork 97
Implement Bracket Pair Highlighting #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Bracket Pair Highlighting #186
Conversation
@thecoolwinter can we add a 2.5 corner radius for the box highlight? |
Yes that would be easy to do quick, I'll do that rq. |
@thecoolwinter Regarding the underline variant. I think I would attach the underline to the bottom of the character instead of the bottom of the line. If the user has a large line height value this underline could be farther away from the character than desired. |
@austincondiff Updated to reflect that change. |
Description
Implements bracket/pair highlighting as described in #67. Adds a few functions to
STTextViewController
:highlightSelectionPairs()
findClosingPair(_ close: String, _ open: String, from: Int, limit: Int, reverse: Bool) -> Int?
to determine the indices of the opening and closing pairs.highlightRange(_ range: NSTextRange, scrollToRange: Bool = false)
bracketPairHighlight
property. Also handles removing animated layers if needed (as in the case of theflash
highlight type).There are two highlight types:
All highlight types are documented in the
BracketPairHighlight
enum.Highlighted pairs are the same set of pairs used for the pair autocomplete filter:
{
}
[
]
<
>
(
)
This feature can also be disabled by setting the
bracketPairHighlight
property onCodeEditTextView
tonil
.Related Issues
Checklist
Screenshots
Box highlight:

Flash highlight:
Screen.Recording.2023-05-03.at.4.43.10.PM.mov
Underline highlight with red color: