Skip to content
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

Matching Bracket/Brace/Paren Highlight #337

Closed
Ansury opened this issue Jul 7, 2016 · 6 comments
Closed

Matching Bracket/Brace/Paren Highlight #337

Ansury opened this issue Jul 7, 2016 · 6 comments

Comments

@Ansury
Copy link

Ansury commented Jul 7, 2016

Enhancement suggestion:
Highlight the closing character for Bracket/Brace/Paren blocks in code (ex. red box outline around the opposite character).

screenshot from 2016-07-07 01 00 18

@Ansury
Copy link
Author

Ansury commented Jul 14, 2016

So, if I were to try implementing such a feature (first of all, would it even be welcome?), is there any specific strategy I should be looking at? This goes for the other feature request I've added.

@JordanMartinez
Copy link
Contributor

would it even be welcome?

If implemented directly on CodeArea, probably not. This project is intended to serve as a base on which others (such as yourself) can build new features (such as the block highlighting).

However, if you wrote an example in the demos package that does what you propose, that would be accepted as an example for others to follow if they desire the same thing.

At the same time, if you see #275, you'll see that Tomas would be greatly interested in one who would build a fully-featured code area on top of this project

@JordanMartinez
Copy link
Contributor

is there any specific strategy I should be looking at?

Tomas would have a better understanding for how to do this. I'll give you my take for now. No doubt you should style the block/parent with a style class specific to that:

  • Wherever the caret is moved to a new position
    • check if previous position caused the highlighting of an open/closing block/parent
    • if so, remove the style class from those two characters
    • get that character next to the caret's new position
    • check if it's one of your valid characters
    • if so, find its corresponding closing block/paren's position & style both opening/closing characters with a style class

@JordanMartinez
Copy link
Contributor

After reading your original comment again, there's one last thing worth sharing. I don't think there is currently a way to create a red (or some other colored) box around a character(s). See the RichTextFX CSS Reference Guide

@TomasMikula
Copy link
Member

I share Jordan's opinion that this is not something that should be directly supported by RichTextFX, but we would welcome a demo that shows how to implement that.

The exact style you have in your screenshot (rectangular outline) is not currently possible, but you could just use background color instead. We would also welcome contribution that adds the outline styling. This would be similar to adding background color (#166) and underline (#317).

@JordanMartinez
Copy link
Contributor

Closing as its outside the scope of this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants