atom/tree-view

Cannot move a directory to its upper neighbor empty folder by dragging

aminya opened this issue · 1 comments

Summary

I cannot move a directory to its upper folder by dragging when the neighbor is empty. It works to all other folders, but not the upper neighbor. It works if the folder is not empty.

tree-view

This happens on 1.54.0-nightly1 or 1.51.0

I debugged the code. The issue is that the drag-over class is constantly removed or added when I drag over the upper neighbor. But for all others, the class stays what it should be.

tree-view-debug

These two methods do this:

tree-view/lib/tree-view.coffee

Lines 1051 to 1075 in bf1181d

onDragEnter: (e) =>
if entry = e.target.closest('.entry.directory')
return if @rootDragAndDrop.isDragging(e)
return unless @isAtomTreeViewEvent(e)
e.stopPropagation()
@dragEventCounts.set(entry, 0) unless @dragEventCounts.get(entry)
unless @dragEventCounts.get(entry) isnt 0 or entry.classList.contains('selected')
entry.classList.add('drag-over', 'selected')
@dragEventCounts.set(entry, @dragEventCounts.get(entry) + 1)
onDragLeave: (e) =>
if entry = e.target.closest('.entry.directory')
return if @rootDragAndDrop.isDragging(e)
return unless @isAtomTreeViewEvent(e)
e.stopPropagation()
@dragEventCounts.set(entry, @dragEventCounts.get(entry) - 1)
if @dragEventCounts.get(entry) is 0 and entry.classList.contains('drag-over')
entry.classList.remove('drag-over', 'selected')
# Handle entry name object dragstart event