-
Notifications
You must be signed in to change notification settings - Fork 363
Conversation
@50Wliu When trying to drag multiple files you click and hold on one of the selected files and drag to a folder. When selecting only a single selected file when multiple are selected you just click on the selected file. We need to make sure the user is not dragging before deselecting all files except for the one that is clicked on. In order to do that we need to do the deselect on mouseup. We still want most mouse operations to occur on mousedown. Only when we need to make sure there is no dragging do we do the operation on mouseup. |
I'm signing up for testing here since I tested the original PR. |
Great work! Let's get this done! I can't believe we can't drag multiple files in atom yet 😆 . |
@Ben3eeE anything holding this up? |
@UziTech Sorry been swamped with other things. I will take a look as soon as I get a chance to, hopefully I will have some time this weekend ⚡️ |
I rebased again and fixed the merge conflicts in the tests |
@Ben3eeE Any way we can get this out the door so I don't have to keep rebasing? |
Please, merge this feature ! |
When a directory and its children are being dragged, only drag the directory, not the individual children.
this test guarantees that dragging a directory d and additional files f into a new directory will move the entire directory d discreetly along with any additional files f.
re-enable a metaclick to allow an item to be selected from the multi-selection. change the behavior of drag image building so that there's no collapsing and properly deselects the drag image.
I believe I fixed the issue where a folder would get deselected when dragging over it with files from another Atom window. I added the class @Ben3eeE I manually tested all of those cases on a Windows 10 and they seem to work as expected. One other case I came across that doesn't work but probably should is dropping a selection on a file. I would expect that the selection would be moved into the same folder as the file that is being dropped on, but right now the move operation is just canceled when dropping on a file. |
Tested this quick and it appears to also be an issue on |
I just added it to this pr |
lib/tree-view.coffee
Outdated
@@ -869,7 +873,7 @@ class TreeView | |||
return | |||
|
|||
entryName = path.basename(initialPath) | |||
newPath = "#{newDirectoryPath}/#{entryName}".replace(/\s+$/, '') | |||
newPath = "#{newDirectoryPath}#{path.sep}#{entryName}".replace(/\s+$/, '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/tree-view.coffee
Outdated
return | ||
e.stopPropagation() | ||
|
||
# TODO: meta+click and ctrl+click should not do the same thing on Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is fixing this something that would require a significant rework of the specs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Any spec that simulates a [ctrl] + [click] on windows, does so by setting e.metaKey to true.
It is also not that big of a deal because in Windows meta(Windows key)+click isn't something people usually do.
lib/tree-view.coffee
Outdated
else if e.metaKey or (e.ctrlKey and process.platform isnt 'darwin') | ||
@selectMultipleEntries(entryToSelect) | ||
# return early if clicking on a selected entry | ||
if entryToSelect.classList.contains('selected') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 blank line
lib/tree-view.coffee
Outdated
@@ -38,6 +38,8 @@ class TreeView | |||
@emitter = new Emitter | |||
@roots = [] | |||
@selectedPath = null | |||
@selectOnMouseUp = null | |||
@lastFocusedElement = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this makes more sense as @lastFocusedEntry
?
lib/tree-view.coffee
Outdated
# menu with only items that make sense for multi select functionality | ||
showMultiSelectMenu: -> | ||
@list.classList.remove('full-menu') | ||
@list.classList.add('multi-select') | ||
|
||
toggleMultiSelectMenu: -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toggle
generally implies "if on, turn off (and vice versa)". Therefore a better name for this method might be showMultiSelectMenuIfNecessary
.
lib/tree-view.coffee
Outdated
newElement.style.paddingRight = "1em" | ||
dragImage.append(newElement) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 extra empty line
Going back to your comment here: #1179 (comment) Perhaps |
I could use |
Would be great to have this 👍 |
Code changes look good to me. @Ben3eeE if you're good with this as well I think it can 🚢? |
I'm looking into this now. going off test plan in #1179 (comment). I'll merge this once I'm done |
I ran into the following while dragging between two atom windows. See gif for repro. Repro steps:
Atom: 1.23.3 x64 Stack TraceUncaught TypeError: Cannot read property 'collapse' of null
|
Nice catch |
@Ben3eeE does this work on windows? I can spend some time testing windows today as well. After the latest change, everything works great on mac! |
@Ben3eeE I think my issues is because I'm running on a VM on mac and it's doing something weird. I'll take a look when I get home on my windows machine and then try to see if I spin up a VM on there for linux. So far everything looks good, but every time I hit ctrl+click it opens up the context menu. I'm noticing this on my VM and happens on the desktop on windows too. |
@ungb I have Ubuntu installed so I can test this on Linux if you run into more issues because of testing in a VM. |
I've tested this and everything looks good to me. I'm going to merge this. I'm going to follow up with the team later on the appveyor failure so we can get this into master. |
Any news on this? |
@jonathan-dejong This is merged but it's not released yet because the tests are failing on |
Description of the Change
Benefits
Multi-select will work like other file explorers
Possible Drawbacks
none
Applicable Issues
Fixes #232
Supersedes and closes #793