-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
"Run until the end of file" only runs once #7801
Comments
I think I found the issue, but have not had time yet to think through a complete solution. I noticed today that "run until end of file" actually does work when the macro only has to run once on a given line. So I downloaded the app source and can see this in the "end of file" loop in NppBigSwitch.cpp:
Since my testcase replaces "a"s with "z"s, and there can be multiple "a"s on a line, I fail the test above after the first "a" on the line and stop processing. |
I have concerns about the comment:
Do you have ideas for how to change the implementation so that it works for your use case but yet does not get into the "...may never end" situation? |
I don't currently, but do plan to look more closely at the source. Hopefully there's a way to both address my issue and keep a "may never end" check. |
I don't have the ability to build and test anything, so all I can do is suggest ideas. Is there not a way, though, to determine the number of characters from the current cursor position to the end of file -- call it CHARS_TO_EOF? After each macro execution, you would break if the current CHARS_TO_EOF is (1) larger than the previous CHARS_TO_EOF, meaning you're moving backwards in the file or you've wrapped around EOF, or (2) equal to the previous CHARS_TO_EOF, meaning you're staying in the same position. |
When I record a macro, open the “Run a Macro Multiple Times” dialog, select “Run until the end of file”, and press “Run”, the macro only executes once (see the exception where it runs twice below). It never runs "to end of file".
Steps to Reproduce the Issue
Expected Behavior
The macro should run until the end of file.
Actual Behavior
The macro only executes once (see the exception where it runs twice below). It never runs "to end of file". Note that If I choose “Run X times”, it does run X times.
Exception: My testcase is to find the letter ‘a’, then record a macro that replaces ‘a’ with ‘z’ and does a Find Next. What I’ve noticed is that when clicking the “Run a Macro Multiple Times” Run button with “Run until the end of file” selected, the macro only runs once EXCEPT when on the last ‘a’ on the line, in which case it replaces that last ‘a’ as well as the first ‘a’ of the next line before it stops. So it does run twice in this case, but never to end of file in this case either.
Debug Information
7.8.2 32-bit on Windows 10
The text was updated successfully, but these errors were encountered: