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 support for duplicating lines #792

Merged
merged 2 commits into from
Sep 15, 2018
Merged

Conversation

scholtzan
Copy link
Member

Duplicates lines that are selected

fn duplicate_line(&mut self, view: &View, config: &BufferItems) {
let mut builder = delta::Builder::new(self.text.len());
// get affected lines
let mut lines = BTreeSet::new();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is almost the same as in modify_indent. Perhaps there is a way to reuse the code...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that could make sense at some point, feels like this is okay for now though.

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.

Looks good; the one thing missing is to add this to the docs.

fn duplicate_line(&mut self, view: &View, config: &BufferItems) {
let mut builder = delta::Builder::new(self.text.len());
// get affected lines
let mut lines = BTreeSet::new();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that could make sense at some point, feels like this is okay for now though.

@scholtzan
Copy link
Member Author

I added it under "Other movement and deletion commands". Not sure if that is the right section though.

@scholtzan scholtzan mentioned this pull request Sep 13, 2018
@nangtrongvuon
Copy link
Member

I noticed Travis has been building this branch for a while. Maybe something got stuck?

@cmyr
Copy link
Member

cmyr commented Sep 15, 2018

hmm, good point. I checked and it said it passed, just this graphic hasn't updated?

@cmyr cmyr merged commit 63ad105 into xi-editor:master Sep 15, 2018
@eyelash
Copy link
Member

eyelash commented Sep 15, 2018

After duplicating multiple lines the selection is somewhat unexpected:

before after
before after

This makes it hard to run duplicate_line multiple times.

@cmyr
Copy link
Member

cmyr commented Sep 15, 2018

hmm good point, I think I'd call that a bug. @scholtzan?

@scholtzan
Copy link
Member Author

Oh, I will look into it.

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

5 participants