zed icon indicating copy to clipboard operation
zed copied to clipboard

editor: Add drag_drop selection

Open CharlesChen0823 opened this issue 8 months ago • 1 comments

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

CharlesChen0823 avatar May 14 '25 07:05 CharlesChen0823

When is this issue going to be addressed?

KENC0DE avatar May 28 '25 10:05 KENC0DE

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.

CharlesChen0823 avatar Jun 07 '25 03:06 CharlesChen0823

Thanks for the quick changes. We just need to handle a few edge cases, then it's good to merge:

  1. 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.
  2. 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

smitbarmase avatar Jun 07 '25 04:06 smitbarmase

  1. 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 avatar Jun 07 '25 04:06 CharlesChen0823

@CharlesChen0823 I have found few more edge cases, I will be pushing those fixes. Hopefully we can merge this today.

smitbarmase avatar Jun 09 '25 01:06 smitbarmase

Thank you!

smitbarmase avatar Jun 09 '25 05:06 smitbarmase

@smitbarmase I thought had break some case.

  1. when mouse move out editor, and then drop, should not do nothing.
  2. when click selected selection cannot reset previous selection.
  3. pre hold ctrl and then drag_drop will drop empty.

I will send pr to fixed this.

CharlesChen0823 avatar Jun 09 '25 05:06 CharlesChen0823

  1. 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.
  2. What do you mean by "cannot reset previous selection" here?
  3. It's not as of my testing, but would like a repro or PR, whichever you like.

smitbarmase avatar Jun 09 '25 05:06 smitbarmase