Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-invoking a mono-instance NPP using new command line parameters issue with plugin query & Debug Info display #11576

Closed
shriprem opened this issue Apr 25, 2022 · 0 comments

Comments

@shriprem
Copy link
Contributor

Issue

Some users prefer to leave an instance of Notepad++ running in the background to avoid the brief wait for the NPP initial launch. Then they have their application/script file continually re-invoke Notepad++ to open some files in a specific way by using NPP's command line parameters. When they do so:

  1. The fresh command line parameters are not being displayed in NPP's Debug Info... dialog.
  2. More importantly, these fresh command line parameters are not being made available to plugins like PythonScript for custom command line parameter processing (with the -z option).

Steps to reproduce the issue

  1. Have Notepad++ set at: Default (mono-instance) under the Multi-instance & Date section in Preferences.
  2. Leave an instance of Notepad++ open or minimized.
  3. Then launch Notepad++ with some new parameters either from a command line or from a batch file.
  4. View the Debug Info... dialog in NPP. The new command line parameters are not being displayed in this dialog.
  5. Use the PythonScript plugin console and execute: notepad.getCommandLine(). This will only report the original command line used to invoke the initial NPP process. This is since PythonScript is using GetCommandLine Windows API.
    image

What is needed

  1. Add a new message NPPM_GETCURRENTCMDLINE to the NPP API. The plugin authors can utilize this query to obtain the current command line string, and use it to process custom command line parameters that are being passed with the -z option.
  2. Optionally, a new message NPPM_GETINITIALCMDLINE to obtain the initial command line string can also be added to the NPP API for complementarity.
  3. Add a new notification NPPN_CMDLINECHANGED to the NPP API. When Notepad++ has been re-invoked, it can notify the plugins that a fresh command line string is available.
  4. When the most recent command line string used to re-invoke NPP is not an empty string, display both the "Initial Command Line" and the "Current Command Line" in the Debug Info... dialog. This will be useful in providing technical support for NPP users.

Additional Info

  1. Please see my comments in response to a user change request for my GotoLineCol plugin.
  2. The same user has also opened issue [Feature] Command Line: Open file in Notepad++ by specifying the column (byte) position #10602 for Notepad++. Resolving this issue may also allow closing of that issue as well. Since then the GotoLineCol plugin will be able to meet the user's requirement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant