Tabs do not open in order selected in Windows Explorer
-
If I shift select several consecutive files alphabetically in Windows Explorer and then right-click and choose “Edit with Notepad++” from the context menu, once they are open in Notepad++ the tabs are not in the same alphabetical order they were selected. Is this intentional, and is there a way to alter this behavior? Thank you for any help!
-
@Clay-Hammons said in Tabs do not open in order selected in Windows Explorer:
select several consecutive files alphabetically in Windows Explorer
When Windows Explorer sends the commands to Notepad++ to open the files, it doesn’t necessarily do it in the order that you select in Explorer. That’s a Windows “feature”. Often, if I select “1 2 3”, I see it open in the order “3 1 2”. (Though in my experiments today, it’s keeping the order for me – no, wait, if i rename “1” to “5” and then try to open “2 3 5” it still opens in order “5 2 3”… I wonder if it’s internally sorted by date/timestamp…)
Anyway, that’s a “feature” of Windows, and there’s nothing they can change in Notepad++ to “fix” it.
You can search the forum for “sort tabs” or similar for discussions on how to change the order of tabs in Notepad++ after the files are opened.
-
As @PeterJones said it’s an Explorer feature. It appears Explorer starts the list where the cursor is when right clicking to start an action on a marked area of selected files and then wraps around to the beginning to complete the list.
-
@artie-finkelstein said in Tabs do not open in order selected in Windows Explorer:
It appears Explorer starts the list where the cursor is when right clicking to start an action on a marked area of selected files and then wraps around to the beginning to complete the list.
Can you explain that a bit more?
I can’t get my head around that explanation. :-) -
@Alan-Kilborn
I’ll try. Given the following list of path names:C:\Notepad++\functionList\batch.xml C:\Notepad++\functionList\c.xml C:\Notepad++\functionList\cobol.xml C:\Notepad++\functionList\cobol-free.xml C:\Notepad++\functionList\cpp.xml C:\Notepad++\functionList\cs.xml C:\Notepad++\functionList\fortran.xml
If I select the list as shown, by marking from bottom to top and leave the cursor on the top entry (
batch.xml
) and drag the selection onto an Npp session, the files will be opened in alphabetical order. However, if I drag the same selection but this time start with the cursor oncs.xml
, the list Npp (or any other application) receives is actually:C:\Notepad++\functionList\cs.xml C:\Notepad++\functionList\fortran.xml C:\Notepad++\functionList\batch.xml C:\Notepad++\functionList\c.xml C:\Notepad++\functionList\cobol.xml C:\Notepad++\functionList\cobol-free.xml C:\Notepad++\functionList\cpp.xml
so the tabs are opened as received, but not in the strict alphabetical order of the marked area. Note: I used an alphabetically sorted list to make it easier for me (it’s my modus operandi), Explorer uses the sort order of the source folder (date, size, etc.). But, Explorer starts with the pathname under the cursor first, iterates to the end of the marked block, and then jumps to the start of the block to complete the list of paths to be passed to the application.
BTW: It’s not UI feature I like, but there seem to be many ways the kids in Redmond tried to make life in Windows too friendly and missed the target.
-
Ah, interesting.
Thanks for the explanation.
I didn’t try it, but I’ll take you at your word.I’ve often wondered where multiple files operations like this obtain their sometimes-odd order; now I have a better idea.
-
@artie-finkelstein is absolutely right here, wanted to reply the same like he.
In short:
Do the right click on the first file you want to have in the Editor. The following files are added one by one like they appear in your explorer window (sorting by name or date etc is respected). At the end of list wraps around to the begin and continues until the right clicked file is reached.Same for drag and drop. Start dragging with focus on the first file you want in the editor.
-
Not following what you mean about “right click”, i.e., your first paragraph. In Explorer, experimenting, I can’t get any kind of multi-file selection with right-clicking. Of course, I can get it with left-click with Shift or Ctrl added.
Your second paragraph is a concise summation of @artie-finkelstein 's longer explanation, but adds no new information.
-
Left click to select items for the group
Right click or left click before dragging the group -
@artie-finkelstein said in Tabs do not open in order selected in Windows Explorer:
Right click or left click before dragging the group
Ah, okay, although I’ve never thought to right-click and drag-n-drop a file(s) into another application.
-
I think that right-clicking would be used to select “Edit with Notepad++” from the context menu.
-
@Stefan-Pendl said in Tabs do not open in order selected in Windows Explorer:
I think that right-clicking would be used to select “Edit with Notepad++” from the context menu.
When I try this with
a.txt
,b.txt
,c.txt
…h.txt
in a folder and I select them one at a time, in order froma
toh
via Ctrl+Lclick, and then I right-clickc.txt
and chooseEdit with Notepad++
, I get, from left to right tabs in N++ once it loads them:d, e, c, f, b, h, g and a.
I fail to see a pattern there.
-
@Alan-Kilborn
I’d never tried it that way. I Ctrl Left clicked a series of files (every other one) and then Right clicked and selected ‘Edit with Notepad++’ and it still followed the scheme I tried to describe in 68868, but, I didn’t properly amplify one detail then: The file list order is based on the Explorer sort order of the folder, not the order the files are clicked in. BTW: changing sort order will unselect any left clicked files.There may also be OS differences (I’ve not had a chance to use any of the Win10 variants).
-
We are probably wandering off-topic here, but it is a bit interesting.
So for great fun I took this selection in Explorer and dragged it by the
e.txt
file into Notepad++ and also Visual Studio 2019:The results:
Entirely opposite tab orders. :-)
And, from an intuitive point of view, since the drag point was
e.txt
, I’d have thought that would be made the active file tab – but it wasn’t in either program.OK, maybe I’m done with this now. :-)
-
@Alan-Kilborn said in Tabs do not open in order selected in Windows Explorer:
Not following what you mean about “right click”, i.e., your first paragraph. In Explorer, experimenting, I can’t get any kind of multi-file selection with right-clicking. Of course, I can get it with left-click with Shift or Ctrl added.
Sorry, that I was not clear enough. The precondition to my previous post is, that you have already selected multiple files in any way you like (Ctrl + Left Click, Shift + Left Click, or even with mouse selection rectangle). The important thing is: the focus in next step. I.e. on which file you do the right click or start the drag action.
@MarkusBodensee said in Tabs do not open in order selected in Windows Explorer:
Do the right click on the first file you want to have in the Editor. The following files are added one by one like they appear in your explorer window (sorting by name or date etc is respected). At the end of list wraps around to the begin and continues until the right clicked file is reached.
Same for drag and drop. Start dragging with focus on the first file you want in the editor.
In your recent post, you verified what I posted for Notepad++, thanks :-)
For the situation in your post before your recent post, where you failed to see a pattern: I don’t know what went wrong there.
When I am doing your steps (and order by name in explorer is active), I get the following order in Notepad++: c, d, e, f, g, h, a, b -