editor: Add drag_drop selection
I thought current version can be ready for review.
Found an issue: in vim_mode, using Esc cannot cancel dragging very well.
Any suggestion?
Closes #4958
Release Notes:
- Add drag_drop for selection
When is this issue going to be addressed?
Also, I noticed that on mouse down inside the selection, the primary cursor flickers. We should fix that.
I left this one, because this is same with vscode.
Thanks for the quick changes. We just need to handle a few edge cases, then it's good to merge:
- I noticed if you drag-n-drop selection correctly and then undo that, drag-n-drop on the current selection doesn't work anymore, and you have to make new one.
- I also think that flicker (both cursor and inline blame) is noticeable enough. I wonder if there is any state where we have selection, but for a frame it's not being rendered?
Also, I noticed that on mouse down inside the selection, the primary cursor flickers. We should fix that.
https://github.com/user-attachments/assets/13ff98f6-34a6-4603-ae99-ff3bca9eeb73
If you'd like to pair on tackling this, that'd be fun: https://calendly.com/smitbarmase/pairing
- I noticed if you drag-n-drop selection correctly and then undo that, drag-n-drop on the current selection doesn't work anymore, and you have to make new one.
you might enable vim_mode, I had notice this problem. But I think this is might break by vim_mode, I have no cue why.
I also think that flicker (both cursor and inline blame) is noticeable enough. I wonder if there is any state where we have selection, but for a frame it's not being rendered?
not flicker when dragging inside selection is intend, I implement reference vscode.
If you'd like to pair on tackling this, that'd be fun: https://calendly.com/smitbarmase/pairing
My english is poor, IMO, comment is enough.
@CharlesChen0823 I have found few more edge cases, I will be pushing those fixes. Hopefully we can merge this today.
Thank you!
@smitbarmase I thought had break some case.
- when mouse move out editor, and then drop, should not do nothing.
- when click selected selection cannot reset previous selection.
- pre hold
ctrland then drag_drop will drop empty.
I will send pr to fixed this.
- This was on purpose, otherwise you, in case of a smaller input field, will have to make sure your cursor doesn't leave the text hitbox area. VSCode also does the same.
- What do you mean by "cannot reset previous selection" here?
- It's not as of my testing, but would like a repro or PR, whichever you like.