notepad-plus-plus / notepad-plus-plus/notepad-plus-plus
Find in macro behaves wrong when macro run until end of file
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 29.4k
- Forks
- 5.4k
- PR merge metrics
- No merged PRs in 30d
Description
Description of the Issue
I have a macro that performs a find. It runs correctly for each line in the file using CTRL-SHIFT-P. If I run the same macro using Run Macro Multiple Times until the end of the file it does not. The next find does not take place at the current cursor position which is the beginning of the next line, the find begins as if the cursor was positioned after the last find.
Steps to Reproduce the Issue
- Create a file with multiple lines like "a - big - cat", "123 - 456 - abc", where the search term occurs one or more times in each line.
- Record a macro that searches for the first " - " using CTRL-F in the line. Close the dialog. Replace the found text with "_". Pres End to move the cursor to the end of the line. Advance the cursor to the beginning of the next line using the Right arrow. Stop recording.
- Run the macro using CTRL-SHIFT-P and the lines will be "a_big - cat", "123_456 - abc".
- Run the macro against the original text using Run Macro Multiple Times until the end of the file and the lines will be "a_big_cat", "123_456_abc".
Expected Behavior
I expect the macro to run starting at the current cursor position, no matter how the macro is executed.
Actual Behavior
See 4. above
Debug Information
Notepad++ v8.6 (64-bit)
Build time : Nov 23 2023 - 16:58:44
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 11 Pro (64-bit)
OS Version : 22H2
OS Build : 22621.2861
Current ANSI codepage : 1252
Plugins :
BracketsCheck (1.2.2)
ColumnTools (1.4.5.1)
ComparePlus (1.1)
HexEditor (0.9.12)
mimeTools (2.9)
NppConverter (4.5)
NppExport (0.4)
NppSaveAsAdmin (1.0.211)
NppXmlTreeviewPlugin (2)
PlanetCNCNpp64 (3001.21.1123.1)
qkNppReverseLines (1)
XMLTools (3.1.1.13)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the described find-and-replace macro, comparing CTRL-SHIFT-P with Run Macro Multiple Times until the end of the file. Trace the macro execution and find behavior to determine why the repeated run uses the previous search position. Done means both execution methods begin each search at the current cursor position and produce the same result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100