home · contact · privacy
Rename "mirror" button to "balance all" and apply it line-by-line.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 12 Feb 2026 18:49:04 +0000 (19:49 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 12 Feb 2026 18:49:04 +0000 (19:49 +0100)
src/templates/edit_structured.html
src/templates/edit_structured.js

index f62b85bd617c1da890df3740a6b2f2c809d02858..92f14cf8480f5e5109e1defe4e383f6ce96cb1e5 100644 (file)
@@ -27,7 +27,7 @@ input.amount {
 {% block content %}
 {{ macros.edit_bar(block, 'structured', 'raw') }}
 <span class="disable_on_taint">
-<input id="btn_mirror" type="button" value="mirror">
+<input id="btn_mirror" type="button" value="balance all">
 <input id="btn_sink" type="button" value="fill sink">
 |
 <input id="btn_replace" type="button" value="replace string">
index 44cbb3d234fa405c61191a9f945da384452338c4..94459d2b717f281ec3a134a0f63e61fc94869086 100644 (file)
@@ -406,9 +406,13 @@ const replace = () => {
 };
 
 const mirror = () => {
-    bookingLines.slice(IDX_PAST_INTRO_LINE).forEach(
-        (line) => bookingLines.push(balance(line))
-    );
+    for (let idx = bookingLines.length; idx > IDX_PAST_INTRO_LINE; idx--) {
+        bookingLines.splice(
+            idx,
+            LEN_EMPTY,
+            balance(bookingLines[idx - LEN_LINE_STEP])
+        );
+    }
     taintAndUpdateForm();
 };