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

[BUG] Macro recording incorrectly records steps #15213

Open
1 task done
kirkanddev opened this issue May 28, 2024 · 2 comments
Open
1 task done

[BUG] Macro recording incorrectly records steps #15213

kirkanddev opened this issue May 28, 2024 · 2 comments

Comments

@kirkanddev
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Description of the Issue

I tried to create a simple macro to use repeatedly in a text file. The steps recorded were simply as follows:
up arrow
cursor to end of line
down arrow
insert linefeed

I examined the macro that was created when I recorded these steps, and Notepad++ recorded the following sequence of Scintilla messages:
SCI_LINEUP
SCI_LINEENDWRAP
SCI_LINEDDOWN
SCI_REPLACESEL
SCI_AUTOCANCELLED

The net result, when I ran the recorded macro, was in some respects similar to what was reported in Bug #15110. Next, I manually went in and edited the macro to be simply the following sequence of messages:
SCI_LINEUP
SCI__LINEEND
SCI_LINEDOWN
SCI_NEWLINE

The manually edited macro worked as expected. Note that I was unable to run the macro to the end of the file. Instead, I had to run it n number of times, repeatedly, until the entire file was processed.

Note that I tried the macro with Windows and UNIX style line endings. And wordwrap is enabled.

Steps To Reproduce

  1. With a text file having a single long string, cursor over to the second character position and hit the 'enter' key so that now there is a two-character string on the first line and a long string on the second line (with the cursor at the beginning of the second line).
  2. Start recording a macro executing the following sequence of steps:
    up arrow
    cursor to end of line
    down arrow
    insert linefeed (i.e., hit 'enter' key)
  3. Stop recording.
  4. Make sure the cursor is at the beginning of the last long string in the file and play the last recorded macro.

Current Behavior

Some text in my file was seemingly overwritten (for a very long string), and an unexpected extra newline is inserted. Referring to example in "expected behavior," this is what I am experiencing (with the cursor left at the newly inserted blank line):
ab
cd

ef
ghijklmnopqrstuv

Expected Behavior

I expected the first two characters of the long string to be on the second-to-last line with the remaining string on the last line. For example:
ab
cd
ef
ghijklmnopqrstuv

And I expected the cursor to be positioned (after running the macro) at the beginning of the last line.

Debug Information

Notepad++ v8.6.5   (64-bit)
Build time : Mar 29 2024 - 17:04:43
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : 
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
Periodic Backup : ON
OS Name : Windows 10 Pro (64-bit
OS Version : 22H2
OS Build : 19045.4412
Current ANSI codepage : 1252
Plugins : 
    HexEditor (0.9.12)
    IndentByFold (0.7.3)
    mimeTools (3.1)
    NppConverter (4.6)
    NppExport (0.4)
    NPPJSONViewer (2.0.5)
    XMLTools (3.1.1.13)

Anything else?

No response

@SDESkowronski
Copy link

Thanks @kirkanddev for linking to my bug ticket.

How do you view and modify a macro? I haven't yet discovered the way to do that.

@kirkanddev
Copy link
Author

@SDESkowronski, look in your Notepad++ installation folder (typically "C:\Program Files\Notepad++" or "C:\Program Files (x86)\Notepad++") for a shortcuts.xml file.
The Macros node contains your macros. Each macro will have action nodes that define that action the macro step should take. Scintilla documentation is here: https://www.scintilla.org/ScintillaDoc.html.

  • Cheers

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

2 participants