-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Add support for multi-caret #123
Comments
Very difficult to do. |
I decided I wanted to tackle this. I don’t think it warrants being part of CodeJar itself (it is a bit too complicated, I think), but I made my code available as a separate JSR package: https://jsr.io/@zamfofex/multiselect Some more information: Apparently Firefox has inbuilt support for multiple selections! (Try it: In Firefox, hold “ctrl” and select some text to add a new selection.) Unfortunately, editing with them works very poorly, so my package adds some better editing capabilities and also common shortcuts (e.g. “ctrl-D” to select occurrences, “ctrl-{up,down}” to add carets above/below). For browsers that don’t support multiple selections (i.e. all browsers except Firefox), I added a small polyfill that uses the custom highlights API to add fake extra selections (and monkeypatch the selection API to make them visible). The custom highlights API is supported in all browsers except Firefox (which doesn’t need it, because it supports multiple selections by itself). The documentation for the package is kinda lacking currently, but I wanted to be able to improve on if I ever add it to a Git repository (if there seems to be some kind of interest on it). If anyone wants to take a look, there is a little “demo” (and/or use case) here: https://zamfofex.neocities.org/aesthetics/ |
@zamfofex I really like your implementation, i would love to talk with u about some things that i been found over this implementation. I really support the idea of making a repo with this implementation. |
It would be awesome to have multi-caret function in CodeJar, just like codemirror or monica. But with the awesome simplicity that codejar has.
The text was updated successfully, but these errors were encountered: