[New Plugin] MultiReplace
-
@Vitalii-Dovgan said in [New Plugin] MultiReplace:
For some reason I had an impression that the Find-Replace list, as well as the histories of the “Find what” and “Replace with” are automatically saved when Notepad++ exits… Could this be added?
I had this already in mind when I started implementation but forgot about it. Yes, I will implement this.
-
@Vitalii-Dovgan said in [New Plugin] MultiReplace:
As maybe an idea for the future version of the MultiReplace plugin, the replacements performance could be dramatically increased
I conducted performance tests yesterday and observed a noticeable difference in performance. There is still room for improvement, but I can confirm that there were no crashes. Specifically, the performance of CopyToClipboard is lacking. However, I will prioritize addressing this in the next release.
I’m considering another feature that could be quite helpful and compensate for the absence of Find capabilities. Next to the Mark button, it might be possible to add up and down keys (similar to those found in NPP Find). After marking, it would be useful to navigate to the marked positions, especially in large files. From a technical standpoint, I’m working on a concept, but I’m not yet convinced about the final result. It would be easy to store all marked positions and sort them. However, if any changes are made to the file, it cannot be guaranteed that these positions are still correct or that the marked text still exists. This presents a limitation. After marking all strings, the plugin should detect any changes. In such cases, the up and down navigation should be disabled. Only by marking all strings again would these buttons be enabled. I haven’t researched Scintilla yet, particularly how to detect changes after a specific moment, and perhaps this would need to be monitored through WM_TIMER. However, I’m still unsure if this limitation is acceptable. There might be other ways to solve it that I haven’t explored yet
-
@Vitalii-Dovgan said in [New Plugin] MultiReplace:
For some reason I had an impression that the Find-Replace list, as well as the histories of the “Find what” and “Replace with” are automatically saved when Notepad++ exits…
The INI support has been integrated. All settings of List, History, and Options are stored in the INI and will be reopened when loading the Plugin.
Due to the addition of some extra features that I am still working on, I will release RC4 a bit later.
-
RC-4 has been finished, featuring:
- New Find and Replace functionality in 2Buttons Mode.
- Sort lists by clicking on the header.
Several optimizations and fixes, including:
- Update of INI Unicode support.
- Updates of Codepage assignments.
- Clipboard copy performance optimization.
- and a lot of other adjustments
Feel free to test it! You can find it on Github.
-
@Thomas-Knoefel said in [New Plugin] MultiReplace:
After marking all strings, the plugin should detect any changes.
Pretty sure the way to check if a file has been modified is to subscribed to the
SCN_MODIFIED
notification and check if thetext
field of the notification object has been populated (since the notification can fire if there are changes other than text changes).But of course your plugin changes the text itself, and so you need some way to distinguish from your plugin’s changes… Hmm…
-
Actually, there’s an even easier way that I just remembered to determine if a
SCN_MODIFIED
notification entails text changing:
check if(notification.modificationType & 3) != 0
This works because
3 = SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT
, and all text modifications trigger a notification with one of those flags set. -
@Mark-Olson said in [New Plugin] MultiReplace:
But of course your plugin changes the text itself, and so you need some way to distinguish from your plugin’s changes… Hmm…
Indeed, this can quickly turn into a complex issue. That’s why I’ve added a regular Find feature, which wasn’t originally planned but serves the same purpose I intended to implement. The advantage here is that it’s easier to maintain and isn’t solely limited to locating positions within Marked Strings. Sometimes, exploring alternative approaches proves to be simpler… thanks for your support; this will answer the questions I was looking for!
-
A tiny thing that confuses me with each update of the plugin: it’s physical name is “NppMultiReplace.dll” and, correspondingly, its folder name is “NppMultiReplace”, and in the same time the plugin identifies itself as “MultiReplace” (without “Npp”) in the main menu.
Maybe the same name in both places would be better? -
@Vitalii-Dovgan said in [New Plugin] MultiReplace:
Maybe the same name in both places would be better?
Agree. Drop the “Npp” - it’s obvious the plugin is for Notepad++. You can name the repo “npp…” if you like, but the plugin DLL itself (and thus folder) should drop the “Npp” prefix.
Cheers.
-
Leading off a plugin name with
Npp
is a sure way to cause it to get visually lost to someone looking for it in the PluginsAdmin list: “Damn, I know it is calledMultiReplace
, how come I can’t find it? Oh, it’s because it is in theN
’s because the dubious decision was made to putNpp
on the front of its name…” -
@Vitalii-Dovgan said in [New Plugin] MultiReplace:
Maybe the same name in both places would be better?
Good point, consistency matters. I’ve renamed project and files to ‘MultiReplace’ and dropped the ‘Npp’ prefix. Changes are in the new RC5 build.
-
@Thomas-Knoefel said in [New Plugin] MultiReplace:
@Vitalii-Dovgan said in [New Plugin] MultiReplace:
Maybe the same name in both places would be better?
Good point, consistency matters. I’ve renamed project and files to ‘MultiReplace’ and dropped the ‘Npp’ prefix.
Excellent, this should be the standard way of naming all plugins: so they can be found alphabetically ordered into the Plugin Menu too.
Thank you. -
Excellent, this should be the standard way of naming all plugins: so they can be found alphabetically ordered into the Plugin Menu too.
The plugin’s file name does not determine the display name in the install menu; that comes from the
"display-name"
property in the JSON manifest embedded in the Plugins Admin DLL.For example, selecting “F# Interactive” installs a module named
NPPFSIPlugin.dll
— with a pointless “-Plugin” suffix as well as prefix!
-
@Thomas-Knoefel said in [New Plugin] MultiReplace:
Changes are in the new RC5 build.
I realize that this is ‘release candidate’ stuff but…
I would guess from the size of the DLL in the “assets” that this is a “debug” build; you probably want to change this to a “release” build (forever more in all your releases of this plugin).
Should also consider a 32-bit build for our N++ family friends that use that one.
-
@Alan-Kilborn said in [New Plugin] MultiReplace:
Should also consider a 32-bit build for our N++ family friends that use that one.
All versions will ultimately be made available as “release” builds when plugin reaches 1.0.0.0 . I have updated RC5 now with all release builds. For all commits, I have an Action preparing the builds in the Git repository, which can be download here as well for the latest RC . (Kudos to @Michael-Vincent for his support with this.)
-
This post is deleted! -
It seems that regex replace with capture group ($1) doesn’t work. Would love to have this feature.
-
This post is deleted! -
This post is deleted! -
I’ve recently completed the Scope Function for the MultiReplace plugin. It lets you set the area (or scope) for Find, Replace, and Marking. Here’s what’s new:
@tomisk: Fix for capturing groups is include in this Pre-Release. Thanks for pointing it out,
Selection Scope:
- Supports single, multi, and rectangular selections.
Column Scope:
- Use the Replace, Find, and Mark functions within distcinct columns of delimited files. Plus, there’s an added highlight feature for these columns.
- Just a note: The file remains editable, even when the plugin is importing a CSV structure.
Marking Performance:
From my observations, highlighting seems a bit slow in N++, especially when marking a large number of unique terms. Thus, I’ve modified the plugin to allow users to cancel the marking process if required.If you cancel and then make edits to unmarked columns, they’ll automatically get highlighted inplace, regardless of their position in the file.
However, highlighting columns isn’t necessary for any operations. It primarily aids in visualization.