feat: add support for auto-pairs#1114
Conversation
|
@altacountbabi We are close to a code freeze before the next release tho, so I think it makes sense to wait until after to merge. |
|
@kronberger-droid I'd probably wait on this one until after the release. I'd also like to see a nushell counterpart PR to this one that enables or disables this feature. |
|
I've independently implemented auto-pairs in a reedline-based project (https://github.com/eitsupi/arf), so I'd like to share some issues I encountered. Two known pitfalls with this designHistory selection leaves orphan closing charsWhen the cursor is inside a pair (e.g. Paste duplicates closing charsPasting Design suggestionThe pub fn with_skip_if<F: Fn(&str, usize, char) -> bool + Send + Sync + 'static>(mut self, f: F) -> Selfwould let callers inject language-specific logic without shadow state. |
Ya, I'd like to see some code to help with this. I've experienced this in code editors and it's a pain sometimes, "NO, I ALREADY HAD A CLOSING PAREN. DON'T ADD ANOTHER!!!!" I probably wouldn't want to land this without something helping with it aggressively closing pairs. |
Haha very relatable. Yeah let's try to get this right. |
Adds
InsertPairandBackspacePairedit commands