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

[WIP] Add SwapLinesUp/Down commands with Alt+Up/Down #90

Closed
wants to merge 3 commits into from
Closed

[WIP] Add SwapLinesUp/Down commands with Alt+Up/Down #90

wants to merge 3 commits into from

Conversation

vain0x
Copy link

@vain0x vain0x commented May 18, 2016

Feature

Swap the lines of selection with the adjucent one.

This is same as Alt+Up/Down in Visual Studio, Ctrl+Shift+Up/Down in Sublime Text, etc.

Sample

zzzz
xx<caret/>xx
wwww

     ↓ Alt+Up ↓

xx<caret/>xx
zzzz
wwww

And with selection.

zzzz
xxx<selection>yyy
yyyy</selection>xxxx
wwww

     ↓ Alt+Up ↓

xxx<selection>yyy
yyyy</selection>xxxx
zzzz
wwww

Issue

I'm now stuck with how to implement "selection restoration". I want to preserve the state of selection after executing the commands as I examplified above. In current implementation, the selection is cleared.

  • Selection Restoration

@vain0x
Copy link
Author

vain0x commented May 19, 2016

I've uploaded my trial implementation for "selection restoration". It sometime works well, but sometime doesn't work. Someone knows?

@dgosbell
Copy link

I would like to see this sort of functionality added to AvalonEdit and I believe I found the issue with why the selection is getting cleared. But I don't believe it's possible for me to make changes to this existing pull request.

If I were to open a new pull request with the updates that maintains the selection/caret position when moving lines up/down is this something you would consider merging or is this sort of functionality something you think should belong in the application layer rather than in the edit control?

@vain0x
Copy link
Author

vain0x commented Jun 19, 2021

  • About this pull request: I have no plan to complete this PR for now. Please create another PR if you are working on this feature. It's free to reuse anything of mine here.
  • About which layer the feature should be implemented in: just in my opinion, it's editor layer since swapping lines is a basic operation and unrelated to application logic.

@vain0x vain0x closed this Jun 19, 2021
@dgosbell dgosbell mentioned this pull request Jun 25, 2021
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