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

[Enhancement] Interpolation of variables in Find Macros #9567

Open
vinsworldcom opened this issue Feb 23, 2021 · 0 comments
Open

[Enhancement] Interpolation of variables in Find Macros #9567

vinsworldcom opened this issue Feb 23, 2021 · 0 comments

Comments

@vinsworldcom
Copy link

Description of the Issue

The shortcuts.xml file recognizes variables like $(NPP_DIRECTORY) and $(CURRENT_WORD) in the <UserDefinedCommands> section, but does not in the <Macros> section. That prevents creating a macro such as:

        <Macro name="Find All CURR_WORD in Current Doc" Ctrl="no" Alt="no" Shift="no" Key="0">
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="$(CURRENT_WORD)" />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1702" wParam="0" lParam="2" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1641" sParam="" />
        </Macro>

The above macro will search for the literal "$(CURRENT_WORD)" in the current doc, rather than interpolating the variable $(CURRENT_WORD) to the currently highlighted text.

Of course, the user may want to literally search for "$(CURRENT_WORD)"; maybe and escape slash \ can be used such as: \$(CURRENT_WORD) to not interpolate the variable?

I searched for this in issues and on the Community, but didn't find a hit.

Steps to Reproduce the Issue

  1. Close all Notepad++
  2. Create the above Macro by editing the shortcuts.xml file
  3. Open Notepad++
  4. Enter some repeated text:
hello
world
hello
all
hello
  1. Highlight the first "hello"
  2. From the menu: Macro => Find All CURR_WORD in Current Doc

Expected Behavior

Find results window shows:

Search "hello" (3 hits in 1 files of 1 searched)
  new 1 (3 hits)
	 1: hello
	 3: hello
	 5: hello

Actual Behavior

Find results window shows:

Search "$(CURRENT_WORD)" (0 hits in 0 files of 1 searched)

Debug Information

Notepad++ v7.9.3 (64-bit)
Build time : Feb 22 2021 - 18:24:04
Path : C:\usr\bin\npp64\notepad++.exe
Admin mode : OFF
Local Conf mode : ON
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 1909
OS Build : 18363.1377
Current ANSI codepage : 1252
Plugins :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant