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

Closed
vain0x wants to merge 3 commits from feature/swap_lines_command into master
vain0x commented 2016-05-18 04:32:24 -05:00 (Migrated from github.com)

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
## 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 commented 2016-05-19 07:18:09 -05:00 (Migrated from github.com)

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

I've uploaded my trial implementation for "selection restoration". It sometime works well, but sometime doesn't work. Someone knows?
dgosbell commented 2021-06-17 21:44:02 -05:00 (Migrated from github.com)

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?

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 commented 2021-06-19 09:30:34 -05:00 (Migrated from github.com)
  • 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.
- 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.

Pull request closed

Sign in to join this conversation.
No description provided.