From 823e753a49eff2d9677dedcdb27ac2c7ff056236 Mon Sep 17 00:00:00 2001
From: Thomas Knoefel <53190206+daddel80@users.noreply.github.com>
Date: Sun, 8 Dec 2024 15:45:43 +0100
Subject: [PATCH 1/5] updated HoverText
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 24a58e4..680f29a 100644
--- a/README.md
+++ b/README.md
@@ -304,7 +304,7 @@ The MultiReplace plugin provides several configuration options, including transp
- **Default**: `DoubleClickEdits=1` (enabled).
- **Description**: When enabled (`1`), double-clicking on a list entry allows direct in-place editing. When disabled (`0`), double-clicking transfers the entry to the input fields for editing.
-- **HoverText**: Enables or disables the display of full text for truncated entries in the **Find**, **Replace**, and **Comment** columns when hovering over them.
+- **HoverText**: Enables or disables the display of full text for truncated list entries when hovering over them.
- **Default**: `HoverText=1` (enabled).
- **Description**: When enabled (`1`), hovering over a truncated entry shows its full content in a pop-up. Set to `0` to disable this functionality.
From 1a9fd7349916f08c17388278d05f833dfc71dc2e Mon Sep 17 00:00:00 2001
From: Thomas Knoefel <53190206+daddel80@users.noreply.github.com>
Date: Mon, 9 Dec 2024 13:40:26 +0100
Subject: [PATCH 2/5] Updated tooltip_enable_list tooltip_disable_list
---
languages.ini | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/languages.ini b/languages.ini
index 42aa879..3604df0 100644
--- a/languages.ini
+++ b/languages.ini
@@ -54,6 +54,8 @@ tooltip_copy_marked_text="Copy Marked Text"
tooltip_display_statistics_columns="Show/Hide Statistics Columns"
tooltip_new_list="New List"
tooltip_save="Save List"
+tooltip_enable_list="Enable list"
+tooltip_disable_list="Disable list"
; List headers
header_find_count="Find Count"
@@ -235,6 +237,8 @@ tooltip_copy_marked_text="Markierten Text kopieren"
tooltip_display_statistics_columns="Statistikspalten ein/ausblenden"
tooltip_new_list="Neue Liste"
tooltip_save="Liste speichern"
+tooltip_enable_list="Aktiviere Liste"
+tooltip_disable_list="Deaktiviere Liste"
; List headers
header_find_count="Suchen Zähler"
@@ -1150,6 +1154,8 @@ tooltip_copy_marked_text="Kopier markeret tekst"
tooltip_display_statistics_columns="Vis/skjul statistikkolonner"
tooltip_new_list="Ny liste"
tooltip_save="Gem liste"
+tooltip_enable_list="Aktivér liste"
+tooltip_disable_list="Deaktivér liste"
; List headers
header_find_count="Find antal"
@@ -1273,4 +1279,4 @@ ctxmenu_enable="&Aktivér Alt+E"
ctxmenu_disable="&Deaktiver Alt+D"
ctxmenu_undo="&Fortryd Ctrl+Z"
ctxmenu_redo="&Gentag Ctrl+Y"
-ctxmenu_add_new_line="Indsæt &Ny Linje Ctrl+I"
\ No newline at end of file
+ctxmenu_add_new_line="Indsæt &Ny Linje Ctrl+I"
From 5303f91a26197825c1003c6c3161d51ecbd443fb Mon Sep 17 00:00:00 2001
From: Thomas Knoefel <53190206+daddel80@users.noreply.github.com>
Date: Mon, 9 Dec 2024 22:20:48 +0100
Subject: [PATCH 3/5] Updated init Examples
---
README.md | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 680f29a..e4e5269 100644
--- a/README.md
+++ b/README.md
@@ -136,12 +136,18 @@ Initializes custom variables for use in various commands, extending beyond stand
Custom variables maintain their values throughout a single Replace-All or within the list of multiple Replace operations. So they can transfer values from one list entry to the following ones. They reset at the start of each new document in 'Replace All in All Open Documents'.
-**Note**: An empty Find string can be used to set variables for the entire Find and Replace list without linking it to a specific Find action. This string will not match any text but is triggered at the start of 'Replace' or 'Replace All' process when 'Use List' is enabled, allowing the Replace field to initialize commands like init() for the entire operation. The position of the entry in the list is irrelevant.
+| Find | Replace | Before | After | Regex | Scope CSV | Description |
+|-------------------|-----------------------------------------------------------------------------------------------------------|-------------------------------------|---------------------------------------|-------|-----------|-------------------------------------------------------------------------------------------------|
+| `(\d+)` | `init({COL2=0,COL4=0}); cond(LCNT==4, COL2+COL4);`
`if COL==2 then COL2=CAP1 end;`
`if COL==4 then COL4=CAP1 end;` | `1,20,text,2,0`
`2,30,text,3,0`
`3,40,text,4,0` | `1,20,text,2,22.0`
`2,30,text,3,33.0`
`3,40,text,4,44.0` | Yes | Yes | Tracks values from columns 2 and 4, sums them, and updates the result for the 4th match in the current line. |
+| `\d{2}-[A-Z]{3}` | `init({MATCH_PREV=''}); cond(LCNT==1,'Moved', MATCH_PREV); MATCH_PREV=MATCH;` | `12-POV,00-PLC`
`65-SUB,00-PLC`
`43-VOL,00-PLC` | `Moved,12-POV`
`Moved,65-SUB`
`Moved,43-VOL` | No | No | Uses MATCH_PREV to track the value of the first match in the line and shift it to the 2nd (LCNT) match during replacements. |
-| Find: | Replace: | Before | After |
-|------------------|---------------------------------------------------------------------------------------------------------------|------------------------------------|-------------------------------------------|
-| `(\d+)` | `init({COL2=0,COL4=0}); cond(LCNT==4, COL2+COL4); if COL==2 then COL2=CAP1 end; if COL==4 then COL4=CAP1 end;` | `1,20,text,2,0`
`2,30,text,3,0`
`3,40,text,4,0` | `1,20,text,2,22.0`
`2,30,text,3,33.0`
`3,40,text,4,44.0` |
-| `\d{2}-[A-Z]{3}`| `init({MATCH_PREV=''}); cond(LCNT==1,'Moved', MATCH_PREV); MATCH_PREV=MATCH;` | `12-POV,00-PLC`
`65-SUB,00-PLC`
`43-VOL,00-PLC` | `Moved,12-POV`
`Moved,65-SUB`
`Moved,43-VOL` |
+An empty Find string can be used to set variables for the entire Find and Replace list without being tied to a specific Find action. This entry does not match any text but is executed once at the beginning of the 'Replace' or 'Replace All' process when 'Use List' is enabled. It allows the Replace field to run initialization commands like `init()` for the entire operation. The position of this entry in the list does not affect its behavior.
+
+| Find | Replace | Description/Expected Output |
+|-------------------|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
+| | `init({ `
`VpersonName = FNAME:sub(1, (FNAME:find(" - ", 1, true) or 0) - 1),`
`Vdepartment = FNAME:sub((FNAME:find(" - ", 1, true) or #FNAME + 1) + 3, (FNAME:find(".", 1, true) or 0) - 1) })` | Extracts `VpersonName` and `Vdepartment` from the filename of the active document in the format ` - .xml` using the `init` action. Triggered only once at the start of the replace process when `Find` is empty. |
+| `personname` | `set(VpersonName)` | Replaces `personname` with the content of the variable `VpersonName`, previously initialized by the `init` action. |
+| `department` | `set(Vdepartment)` | Replaces `department` with the content of the variable `Vdepartment`, previously initialized by the `init` action. |
#### **fmtN(num, maxDecimals, fixedDecimals)**
Formats numbers based on precision (maxDecimals) and whether the number of decimals is fixed (fixedDecimals being true or false).
@@ -181,13 +187,13 @@ This example shows how to use `if` statements with `cond()` to manage variables
The `DEBUG` option lets you inspect global variables during replacements. When enabled, it opens a message box displaying the current values of all global variables for each replacement hit, requiring confirmation to proceed to the next match. Initialize the `DEBUG` option in your replacement string to enable it.
-| Find: | Replace with: |
+| Find | Replace |
|------------|--------------------------------------------|
| `(\d+)` | `init({DEBUG=true}); set("Number: "..CAP1)`|
### More Examples
-| Find in: | Replace with: | Description/Expected Output | Regex | Scope CSV |
+| Find | Replace | Description/Expected Output | Regex | Scope CSV |
|---------------------|-------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|-------|-----------|
| `;` | `cond(LCNT==5,";Column5;")` | Adds a 5th Column for each line into a `;` delimited file. | No | No |
| `key` | `set("key"..CNT)` | Enumerates key values by appending the count of detected strings. E.g., key1, key2, key3, etc. | No | No |
From b33791636cedd8301e2b1cf223c8ea2fe228f5f9 Mon Sep 17 00:00:00 2001
From: Thomas Knoefel <53190206+daddel80@users.noreply.github.com>
Date: Tue, 10 Dec 2024 09:15:37 +0100
Subject: [PATCH 4/5] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index e4e5269..8f45d5b 100644
--- a/README.md
+++ b/README.md
@@ -139,7 +139,7 @@ Custom variables maintain their values throughout a single Replace-All or within
| Find | Replace | Before | After | Regex | Scope CSV | Description |
|-------------------|-----------------------------------------------------------------------------------------------------------|-------------------------------------|---------------------------------------|-------|-----------|-------------------------------------------------------------------------------------------------|
| `(\d+)` | `init({COL2=0,COL4=0}); cond(LCNT==4, COL2+COL4);`
`if COL==2 then COL2=CAP1 end;`
`if COL==4 then COL4=CAP1 end;` | `1,20,text,2,0`
`2,30,text,3,0`
`3,40,text,4,0` | `1,20,text,2,22.0`
`2,30,text,3,33.0`
`3,40,text,4,44.0` | Yes | Yes | Tracks values from columns 2 and 4, sums them, and updates the result for the 4th match in the current line. |
-| `\d{2}-[A-Z]{3}` | `init({MATCH_PREV=''}); cond(LCNT==1,'Moved', MATCH_PREV); MATCH_PREV=MATCH;` | `12-POV,00-PLC`
`65-SUB,00-PLC`
`43-VOL,00-PLC` | `Moved,12-POV`
`Moved,65-SUB`
`Moved,43-VOL` | No | No | Uses MATCH_PREV to track the value of the first match in the line and shift it to the 2nd (LCNT) match during replacements. |
+| `\d{2}-[A-Z]{3}` | `init({MATCH_PREV=''}); cond(LCNT==1,'Moved', MATCH_PREV); MATCH_PREV=MATCH;` | `12-POV,00-PLC`
`65-SUB,00-PLC`
`43-VOL,00-PLC` | `Moved,12-POV`
`Moved,65-SUB`
`Moved,43-VOL` | Yes | No | Uses MATCH_PREV to track the value of the first match in the line and shift it to the 2nd (LCNT) match during replacements. |
An empty Find string can be used to set variables for the entire Find and Replace list without being tied to a specific Find action. This entry does not match any text but is executed once at the beginning of the 'Replace' or 'Replace All' process when 'Use List' is enabled. It allows the Replace field to run initialization commands like `init()` for the entire operation. The position of this entry in the list does not affect its behavior.
From f732ded1ce0e3b7eb72606d5aac38a70691cc1b1 Mon Sep 17 00:00:00 2001
From: Thomas Knoefel <53190206+daddel80@users.noreply.github.com>
Date: Tue, 10 Dec 2024 18:57:55 +0100
Subject: [PATCH 5/5] Update README.md
---
README.md | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index 8f45d5b..d851d6c 100644
--- a/README.md
+++ b/README.md
@@ -193,17 +193,18 @@ The `DEBUG` option lets you inspect global variables during replacements. When e
### More Examples
-| Find | Replace | Description/Expected Output | Regex | Scope CSV |
-|---------------------|-------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|-------|-----------|
-| `;` | `cond(LCNT==5,";Column5;")` | Adds a 5th Column for each line into a `;` delimited file. | No | No |
-| `key` | `set("key"..CNT)` | Enumerates key values by appending the count of detected strings. E.g., key1, key2, key3, etc. | No | No |
-| `(\d+)` | `set(CAP1.."€ The VAT is: ".. (CAP1 * 0.15).."€ Total with VAT: ".. (CAP1 + (CAP1 * 0.15)).."€")` | Finds a number and calculates the VAT at 15%, then displays the original amount, the VAT, and the total amount. E.g., `50` becomes `50€ The VAT is: 7.5€ Total with VAT: 57.5€` | Yes | No |
-| `---` | `cond(COL==1 and LINE<3, "0-2", cond(COL==2 and LINE>2 and LINE<5, "3-4", cond(COL==3 and LINE>=5 and LINE<10, "5-9", cond(COL==4 and LINE>=10, "10+"))))` | Replaces `---` with a specific range based on the `COL` and `LINE` values. E.g., `3-4` in column 2 of lines 3-4, and `5-9` in column 3 of lines 5-9 assuming `---` is found in all lines and columns.| No | Yes |
-| `(\d+)\.(\d+)\.(\d+)`| `cond(CAP1 > 0 and CAP2 == 0 and CAP3 == 0, MATCH, cond(CAP2 > 0 and CAP3 == 0, " " .. MATCH, " " .. MATCH))` | Alters the spacing based on the hierarchy of the version numbers, aligning lower hierarchies with spaces as needed. E.g., `1.0.0` remains `1.0.0`, `1.2.0` becomes ` 1.2.0`, indicating a second-level version change.| Yes | No |
-| `(\d+)` | `set(CAP1 * 2)` | Doubles the matched number. E.g., `100` becomes `200`. | Yes | No |
-| `;` | `cond(LCNT == 1, string.rep(" ", 20- (LPOS))..";")` | Inserts spaces before the semicolon to align it to the 20th character position if it's the first occurrence. | No | No |
-| `-` | `cond(LINE == math.floor(10.5 + 6.25 * math.sin((2 * math.pi * LPOS) / 50)), "*", " ")` | Draws a sine wave across a canvas of '-' characters spanning at least 20 lines and 80 characters per line. | No | No |
-| `^(.*)$` | `init({MATCH_PREV=1}); cond(MATCH == MATCH_PREV, ''); MATCH_PREV=MATCH;` | Removes duplicate lines, keeping the first occurrence of each line. Matches an entire line and uses `MATCH_PREV` to identify and remove consecutive duplicates. | Yes | No |
+| Find | Replace | Regex | Scope CSV | Description |
+|-------------------|-----------------------------------------------------------------------------------------------------------|-------|-----------|-------------------------------------------------------------------------------------------------|
+| `;` | `cond(LCNT==5,";Column5;")` | No | No | Adds a 5th Column for each line into a `;` delimited file. |
+| `key` | `set("key"..CNT)` | No | No | Enumerates key values by appending the count of detected strings. E.g., key1, key2, key3, etc. |
+| `(\d+)` | `set(CAP1.."€ The VAT is: ".. (CAP1 * 0.15).."€ Total with VAT: ".. (CAP1 + (CAP1 * 0.15)).."€")` | Yes | No | Finds a number and calculates the VAT at 15%, then displays the original amount, the VAT, and the total amount. E.g., `50` becomes `50€ The VAT is: 7.5€ Total with VAT: 57.5€`. |
+| `---` | `cond(COL==1 and LINE<3, "0-2", cond(COL==2 and LINE>2 and LINE<5, "3-4", cond(COL==3 and LINE>=5 and LINE<10, "5-9", cond(COL==4 and LINE>=10, "10+"))))` | No | Yes | Replaces `---` with a specific range based on the `COL` and `LINE` values. E.g., `3-4` in column 2 of lines 3-4, and `5-9` in column 3 of lines 5-9 assuming `---` is found in all lines and columns. |
+| `(\d+)\.(\d+)\.(\d+)` | `cond(CAP1 > 0 and CAP2 == 0 and CAP3 == 0, MATCH, cond(CAP2 > 0 and CAP3 == 0, " " .. MATCH, " " .. MATCH))` | Yes | No | Alters the spacing based on the hierarchy of the version numbers, aligning lower hierarchies with spaces as needed. E.g., `1.0.0` remains `1.0.0`, `1.2.0` becomes ` 1.2.0`, indicating a second-level version change. |
+| `(\d+)` | `set(CAP1 * 2)` | Yes | No | Doubles the matched number. E.g., `100` becomes `200`. |
+| `;` | `cond(LCNT == 1, string.rep(" ", 20- (LPOS))..";")` | No | No | Inserts spaces before the semicolon to align it to the 20th character position if it's the first occurrence. |
+| `-` | `cond(LINE == math.floor(10.5 + 6.25 * math.sin((2 * math.pi * LPOS) / 50)), "*", " ")` | No | No | Draws a sine wave across a canvas of '-' characters spanning at least 20 lines and 80 characters per line. |
+| `^(.*)$` | `init({MATCH_PREV=1}); cond(MATCH == MATCH_PREV, ''); MATCH_PREV=MATCH;` | Yes | No | Removes duplicate lines, keeping the first occurrence of each line. Matches an entire line and uses `MATCH_PREV` to identify and remove consecutive duplicates. |
+
#### Engine Overview
MultiReplace uses the [Lua engine](https://www.lua.org/), allowing for Lua math operations and string methods. Refer to [Lua String Manipulation](https://www.lua.org/manual/5.4/manual.html#6.4) and [Lua Mathematical Functions](https://www.lua.org/manual/5.4/manual.html#6.6) for more information.