-
Notifications
You must be signed in to change notification settings - Fork 700
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 surrounding_pairs option to xi-core-lib; add InsertDrift #968
Conversation
9d340c7
to
684c84c
Compare
Cool, I'll put this in my review docket for tomorrow. 👍 |
684c84c
to
1de3a0d
Compare
@cmyr added tests! |
This adds the surrounding_pairs option. If all selections are regions (and not carets) and the user types a first half of a surrounding pair, then we will surround the selection with the surrounding pair instead of replacing the selection. This config option can be edited on a per- language basis. This change also adds InsertDrift as a replacement for the old keep_selections option. The keep_selections bool, if true, overrode the 'after' property, ensuring that inserts 'drifted' to the side of a cursor that was inside a selection. This change keeps that same functionality, but adds the option to have inserts 'drift' to the outside of a selection instead.
1de3a0d
to
9e6feef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'm into this; I think there are some other little problems with how we deal with selection expansion but this is a clean patch that fixes a real problem, so let's get this in and see how much it buys us!
I think we need a rebase, but otherwise looks good. You should have commit writes to this repo, and can merge whenever.
Playing with this, I think it naturally makes sense to look at the sibling feature of 'auto-closing pairs'?
Thanks, sounds good! Ok to use GitHub's "rebase and merge" button, or do we prefer manual rebases? |
And sounds good — glad to look at auto-closing pairs next. |
@lord actually rebase and merge should be fine; i was thinking of a manual rebase to get the updated CI config but it's already passed travis so I think we're gtg :) |
Done! 😄 |
Summary
This adds the surrounding_pairs option. If all selections are regions (and not carets) and the user types a first half of a surrounding pair, then we will surround the selection with the surrounding pair instead of replacing the selection. This config option can be edited on a per- language basis.
This change also adds
InsertDrift
as a replacement for the old keep_selections option. The keep_selections bool, if true, overrode the 'after' property, ensuring that inserts 'drifted' to the side of a cursor that was inside a selection. This change keeps that same functionality, but adds the option to have inserts 'drift' to the outside of a selection instead.It's not ~fully tested or complete, but the functionality works, and I thought I'd submit this WIP just to see if this is the right approach before investing more time into it?
Related Issues
A part of several tasks within #647
Checklist
Review Checklist
cargo test --all
/./rust/run_all_checks
.