notepad-plus-plus / nppShell

Provide Explorer context menu entry "Edit with Notepad++"
GNU General Public License v3.0
25 stars 13 forks source link

Regression: NppShell open multi-files on Notepad++ multi-instance mode #36

Closed donho closed 1 year ago

donho commented 1 year ago

Bug report: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13778

Here is illustration to turn Always in multi-instance mode option ON:

image

The correct/legacy behaviour with Always in multi-instance mode option ON is: If Notepad++ is launched manually N times, there should be N instances of Notepad++ open. Here the scenario:

  1. Firstly user selects A.txt & B.txt via Explorer, then right-click to run Edit with Notepad++, the 1st instance of Notepad++ will be launched, and contains both A.txt & B.txt.
  2. Secondly user selects X.txt, Y.txt & Z.txt via Explorer, right-click to run Edit with Notepad++, the 2nd instance of Notepad++ will be launched, and contains both X.txt, Y.txt & Z.txt.

Such legacy behaviour has been verified in an old version (v8.3.3) of Notepad++, and the result is as expected. Here's its debug info:

Notepad++ v8.3.3   (64-bit)
Build time : Mar 13 2022 - 17:20:02
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : "C:\eula.2052.txt" "C:\eula.3082.txt" "C:\globdata.ini"
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 10 Pro (64-bit) 
OS Version : 2009
OS Build : 19045.2604
Current ANSI codepage : 1252
Plugins : mimeTools.dll NppConverter.dll NppExport.dll

However, after updating Notepad++ from v8.3.3 to v8.5.3 (and restart Explorer process), then open the same 3 files via Edit with Notepad++, 3 instances has been opened, and each instance contains 1 file:

Instance 1:

Notepad++ v8.5.3   (64-bit)
Build time : May 15 2023 - 06:09:36
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : "C:\eula.2052.txt"
...

Instance 2:

Notepad++ v8.5.3   (64-bit)
Build time : May 15 2023 - 06:09:36
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : "C:\eula.3082.txt"
...

Instance 3:

Notepad++ v8.5.3   (64-bit)
Build time : May 15 2023 - 06:09:36
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : "C:\globdata.ini"
...

Manually launch Notepad++ v8.5.3 from command line, by keeping Always in multi-instance mode option ON: notepad++.exe "C:\eula.2052.txt" "C:\eula.3082.txt" "C:\globdata.ini" 3 files are opened in the same instance, and here its debug info:

Notepad++ v8.5.3   (64-bit)
Build time : May 15 2023 - 06:09:36
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : "C:\eula.2052.txt" "C:\eula.3082.txt" "C:\globdata.ini"
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 10 Pro (64-bit)
OS Version : 22H2
OS Build : 19045.2604
Current ANSI codepage : 1252
Plugins : 
    mimeTools (2.9)
    NppConverter (4.5)
    NppExport (0.4)
    NPPJSONViewer (1.40)

Conclusion: NppShell launches N times Notepad++ if N files are selected in Explorer - It is not correct: NppShell should launch notepad++.exe only once and pass the file paths altogether to it.

GurliGebis commented 1 year ago

@donho I'll take a look at it, I'm pretty sure I know what the problem is. Might be a few days before I get around to it though

donho commented 1 year ago

@GurliGebis Thank you!

GurliGebis commented 1 year ago

@donho the PR looks line

pnedic commented 1 year ago

if selected "Default (mono instance)", all selected files in win explorer are opened in one EPP window. If selected "Always in multi-instance mode", for each selected file in win explorer, new EPP window is opened. If selected "Open session in a new instance (and save....)", the same behavior as "Default (mono instance)"

I need for some selected files in win explorer, on right click option "Edit with Notepad++" to open NEW EPP window with opened ONLY selected files. This was situation until version 8.5.3. You screwed this with version 8.5.3. and version 8.5.4 did NOT fix it (its been told as fixed) !?

Please check it again

This is really frustrating !!!

pnedic commented 1 year ago

OK, now I've got desired behavior of NPP: I did uninstall (complete) and fresh install of new version (8.5.4). This helped to fix previously mentioned problem. So solution is to complete reinstall of NPP. At least, it helped to me.