Enhance OpenType feature code editor 2nd attempt - #2212
Conversation
… OpenType feature code panel with syntax highlighting, improve styling, and add indentWithTab support
…asily removed if necessary.
|
The basicSetup includes historyKeymap that handles undo/redo and undoSelection/redoSelection. So it can't be used if we want to use the Fontra shortcuts system, right? |
|
I'm afraid I'm seeing the same behavior as with the previous PR:
|
|
Hmm, I'm on Windows; I try it in Chrome and Firefox, and it looks fine. |
|
Ahh, it has to do with the .fea data that I'm looking at, esp. messed up data. Here's a snippet that manages to make the feature editor/panel hang (at least in Chrome and Ff, yet interestingly not in Safari): I hope you can reproduce it on Windows in Chrome or Firefox. |
|
You're right. The glyph class regex that causes the hang. That can't handle this part: |
|
Can the regexes be written in a way so they can never hang? The syntax coloring obviously needs to be resilient against invalid input. |
…ighlighting support (previously combined with glyph class)
|
It should work now |
|
Thank you, it is working really well now. I've been looking into why integration with the Fontra shortcuts doesn't work, and there are two reasons:
So, for now, this is just not expected to work, and let's keep the codemirror keymap as it is. I'm ready to merge this. Are you ready with it? I see you added many more nice things in the meantime, really great! |
|
I missed the spec that ranges, glyphs, and glyph class names can be combined in a glyph class like this: The coloring will be messed up in this case. |
I will try to fix this issue in next PR |
|
I edited the CHANGELOG, please let me know if it can/should be improved: https://github.com/googlefonts/fontra/blob/main/CHANGELOG.md#2025-07-08 |
All of this actually just extracted from the basicSetup bundle, which already existed previously
|
|
So, should I edit down the CHANGELOG entry to the items you list? |
Maybe, because I only improved the CodeMirror setup. |
|
I only removed these items:
I think all other items were indeed added by you. Let me know if you find this correct. |
|
Okay, undo/redo and toggle comment are part of the |
Fixes #2186, fixes #2101, fixes #2106 and add indent with tab support
For color coding/syntax highlighting is using CodeMirror 5-style stream parser which may need to be upgraded for more advanced needs. But I think it works for now.
Undo/redo and toggle comment shortcuts still use codemirror keymaps.