-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Automatically close brackets and quotes #1801
Comments
I.e. appending a closing quote next to the text cursor? If so, and without additional input (other than text), what happens when the user inserts a paragraph break? Will the editor: a. skip the quote symbol (leaving it as a closing paragraph character) and insert the break after? In the latter case, then please consider allowing to auto-add a continuation quote symbol (as explained in #1770) on these particular circumstances. It would be an excellent feature to have. |
That would be an additional feature. It would need an extra field to specify this symbol, as the highlight rules related to #1770 are not going to be this specific. This is a non-trivial thing to implement due to the need for full paragraph lookback. Currently, the editor only keeps a record of the last three characters. It doesn't actually know that you are inside a quote. So adding this feature may require too much processing. There is already a lot of code that is run every time you press a key, and Python is still a lot slower than C++. Perhaps it could be a feature that only worked when auto-inserting closing quotes. I could set a flag when this mode is triggered and clear it when you leave the paragraph. So if it does this only as long as you keep typing without moving the cursor in other ways, I could probably make a lightweight implementation of it. I haven't decided yet how to handle getting "out of" the auto-added closing symbol either. In code editors you either have to press the right arrow key, or type the closing symbol to skip past it. The latter sort of defeats the purpose, but it is what code editors tend to do. It's also what Obsidian does. |
Some code editors allow you to tab out of an auto-closed section, provided you haven't done anything else than inserting code. The cursor either jumps to the next section, if there is one, or to the EOL. Also some editors allow you via hotkey to insert a new line (edit - from wherever your cursor is, and without carrying over any trailing code of the current line) and jump to the start of it, which is one way to skip typing a “purpose-defeating” section close symbol. I'm not suggesting any of this, just throwing more known features out there. Perhaps a solution arises from it. |
Yeah, having to type the closing character defeats the purpose, and having to press the arrow key can be annoying, so I definitely would like to add some way to make it more useful. |
Add an optional auto-feature to close brackets and quotes. Closing brackets and quotes should be separate settings since the user may want the former without the latter, depending on the writing style.
This is a common feature in code editors, and at least I am very used to it. I also noticed Obsidian added it recently.
The text was updated successfully, but these errors were encountered: