Drag'n dropping from explorer opens a new atom window


#1

On Windows 7, think it started after version 1.1.0, currently on 1.2.3.

Happens with “–safe”, happens on two seperate computers.

To be exact this is what happens, step by step:

  1. Open atom with explorer context menu in a folder, “Open with Atom”. (call this Window-1)
  2. drag’n drop a file from explorer onto the opened Window-1
  3. a new window (Window-2) opens with the drag’n dropped file open and other files aswell if “folder state / project state” had been saved with them open prevously (was it that Atom calls a folder a project etc ?)
  4. when drag’n dropping more files onto Window-2 they open inside that window as expected and no new windows open.

dont know how to debug it further than… :confused:

Tried searching discuss, no luck.


#2

No replies makes me think this is something i’v specifically messed up on my side and am alone with this problem :cry:

Tried deleting the folders below
%home%\AppData\Local\atom
%home%\AppData\Roaming\Atom
%home%.atom

The problem still persists, it’s starting to freak me out, there’s elves in my computer messing with my stuffs…

Something I did notice, normally I do not have the tree-view package enabled, but now trying out with fresh installs the drag’n dropped file opened the new window where the dropped file appeared as if it were the project root folder. This feels fishy.

for example initially on first open the tree-view looked like this:

[folder icon] MyProjectFolder
[file icon] MyFile1.txt
[file icon] MyFile2.txt

after drag’n dropping the file “MyFile1.txt” from explorer the newly opened atom window has a tree-view looking like this:

[folder icon] MyFile1.txt

I would really really love if this behaviour could be stopped somehow


#3

I don’t know, I don’t use drag-and-drop really.

I suspect if it is happening for you the same way every time that it is just the way Atom behaves. Like I say, I never use drag-and-drop to open new files.


#4

Over the years I’v grown accustomed to having one (tabbed, go QTTabBar!) explorer window open for fs browsing, so I’v disabled the tree-view for being too restrictive for my navigational needs :smile: And i like the fact that the editor window is just that, an editor window without other eh…clutter, the little minimalist in me cheers :smile:

But, to the point, Atom did not always behave like this, some older version never opened new windows like this, not totally sure at what point it changed…could propably check the exact version change after this started happening.


#5

If you could do that, it would be very helpful!


#6

The change definitely happened between 1.1.0 and 1.2.0 (1.2.0-beta0). As in 1.1.0 “works ok” and opens dropped files in a new tab. Anything more recent as in 1.2.0 or 1.2.0-beta0 open dropped files in a new window.

Have not yet had the time to check the actual code changes…looking at git made my head dizzy…can try using winmerge etc to inspect the release packages if theres something obvious that I could catch.


#7

Okay, did some digging in 1.2.0-beta0 sources and am 90% sure the problem is in atom.asar/src/browser/atom-application.js file.

Changes between lines 620 and 641 (AtomApplication.prototype.openPaths function) are suspect. the currentWindow variable is never initialized before use for example. And various other changes, one set of redundant curlys left in the code, perhaps a typo.

the “brute force” change of adding 2 lines (from 1.1.0) after line 620 “fixes” the situation:
currentWindow = window != null ? window : this.lastFocusedWindow;
if(currentWindow) existingWindow = currentWindow;

Obviously the above change is “wrong” as it just forces the new window not to open, surely it brakes something else…but to demostrate that this may just be the location where a fix could be located.


#8

Looks like someone opened an Issue on this already:


#9

Wow nice, thanks leedohm for pointing out the issue, will keep tabs on it.


#10

I have the same issue, it would not be a problem to have a new editor popping up but since it is too slow, I would like to keep just one instance of Atom.