Closed ProgerXP closed 7 months ago
Done.
In the end, we have changed the meaning of -R
and -N
switches compared to Notepad2:
-R
or -N
- "try reusing": search for an existing process with Reuse Window enabled; if found, open the file there and exit; if not, continue (open new window)-R
only - "force reusing": as above but works differently if no process was found: if there is any process (that is, with Reuse Window disabled) then open the file in an arbitrary one and enable Reuse Window in that process; if there are no Notepad 2e processes at all, continue (open new window) and enable Reuse Window-N
only - "no reusing": don't examine other processes, always open new window-R
and -N
: as above except that Reuse Window is enabled in the new windowIn Notepad2, ReuseWindow
state is stored in the INI; giving -R
or -N
overrides that (default) value for this particular process while giving none uses the INI's value (giving both is illegal).
In Notepad2, if INI is not in use, Settings > Reuse Window is non-functional but the CLI switches are allowed. In Notepad 2e, the INI is no longer used for this feature at all.
both
-R
and-N
: as above except that Reuse Window is enabled in the new window
Let's change the meaning of this combination:
-R
and -N
: as "try reusing" but if a new window was opened, enable Reuse Window in it (so either open in an existing process with Reuse Window or start a new process with Reuse Window so that subsequent Notepad2e.exe -R -N
will reuse it)Done.
Toggling Settings > Reuse Window in Notepad2 causes the change across all running Notepad2 instances and makes it unpredictable which window will receive the newly opened file.
This setting must be individual to every process just like most settings (but not Sticky Window Position or Single File Instance) so that when starting a new process instances with this flag disabled are not considered. Persisting this in INI must be removed.
Update: in Notepad2 this flag doesn't act as a filter when launching a process; it simply determines if (any) new process must reuse any existing process.