Skip to content

A recorded macro with "Find Next" and then "Run until the end of file" crashes Notepad++ #13342

@BdR76

Description

@BdR76

Description of the Issue

When you record a macro that includes a step with "Find Next", and you select "Run a Macro Multiple times" with the option "Run until the end of file", then it will get stuck in a loop and Notepad++ freezes.

Steps to Reproduce the Issue

Example file

      <mappingPart>
        <source column="v_0" />
        <destination observationCode="demin_leefstijl_0" />
      </mappingPart>
      <mappingPart>
        <source column="v_1" />
        <destination observationCode="demin_leefstijl_1" />
      </mappingPart>
      <mappingPart>
        <source column="v_2" />
        <destination observationCode="demin_leefstijl_2" />
      </mappingPart>
  1. Type the text pivotResultColumn="data" />, select & copy/cut it so it's on the clipboard
  2. Go to beginning of the example file
  3. Go to menu Macro > Start recording
  4. Ctrl+F to find next <source column="v to move the cursor to next instance
  5. Press End key to go to end of that line
  6. select last two characters />
  7. Paste pivotResultColumn="data" />
  8. Go to menu Macro > Stop recording
  9. Now go to Macro > Run a Macro Multiple times
  10. Select Run until the end of file and press OK.

Expected Behavior

The macro should run until the end of the file, so break/stop when "Find Next" wraps around to the beginning of the file, or alternatively when "Find Next" yields no more results.

Actual Behavior

The macro runs indefinitely and Notepad++ freezes

Debug Information

Notepad++ v8.4.8 (64-bit)
Build time : Dec 24 2022 - 19:40:27
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows Server 2019 Standard (64-bit)
OS Version : 1809
OS Build : 17763.3887
Current ANSI codepage : 1252
Plugins :
ComparePlugin (2.0.2)
CSVLint (0.4.6.2)
CsvQuery (1.2.8)
HexEditor (0.9.12)
mimeTools (2.9)
NppConverter (4.5)
NppExport (0.4)
NPPJSONViewer (1.40)
NppMarkdownPanel (0.5)
PoorMansTSqlFormatterNppPlugin (1.6.13.31508)
RandomValuesNppPlugin (0.2.1)
XMLTools (3.1.1.13)

fyi, I encountered this while trying to manually edit a large XML file, and paste the pivotResultColumn property to the end of each source tag, but only when column name starts with the letter v.

I've found a work-around which is to first Find > Count to see how many instances the Find Next will get, for example count is 1389, and then select Run 1389 times instead of "until end of file".

Also, maybe this is somehow related to issue #12126 ?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions