Skip to content
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

Merged
merged 1 commit into from
Nov 3, 2018

Conversation

lord
Copy link
Member

@lord lord commented Oct 31, 2018

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

  • Still need to add tests

Review Checklist

  • I have responded to reviews and made changes where appropriate.
  • I have tested the code with cargo test --all / ./rust/run_all_checks.
  • I have updated comments / documentation related to the changes I made.
  • I have rebased my PR branch onto xi-editor/master.

@cmyr
Copy link
Member

cmyr commented Nov 1, 2018

Cool, I'll put this in my review docket for tomorrow. 👍

@lord lord changed the title [WIP] Add surrounding_pairs option to xi-core-lib; add InsertDrift Add surrounding_pairs option to xi-core-lib; add InsertDrift Nov 2, 2018
@lord
Copy link
Member Author

lord commented Nov 2, 2018

@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.
Copy link
Member

@cmyr cmyr left a 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'?

@lord
Copy link
Member Author

lord commented Nov 3, 2018

Thanks, sounds good! Ok to use GitHub's "rebase and merge" button, or do we prefer manual rebases?

@lord
Copy link
Member Author

lord commented Nov 3, 2018

And sounds good — glad to look at auto-closing pairs next.

@cmyr
Copy link
Member

cmyr commented Nov 3, 2018

@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 :)

@lord lord merged commit 35fc296 into xi-editor:master Nov 3, 2018
@lord lord deleted the surrounding-pairs branch November 3, 2018 21:40
@lord
Copy link
Member Author

lord commented Nov 3, 2018

Done! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants