From a70f1f28b03e2cd053f9b4d57bc6141729ef63e3 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Thu, 5 Sep 2024 11:36:35 -0700 Subject: [PATCH] Don't grow multiline setting values on every save --- src/jvmMain/kotlin/dev/romainguy/kotlin/explorer/State.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jvmMain/kotlin/dev/romainguy/kotlin/explorer/State.kt b/src/jvmMain/kotlin/dev/romainguy/kotlin/explorer/State.kt index 02259f62..425cf6df 100644 --- a/src/jvmMain/kotlin/dev/romainguy/kotlin/explorer/State.kt +++ b/src/jvmMain/kotlin/dev/romainguy/kotlin/explorer/State.kt @@ -141,8 +141,10 @@ private fun readSettings(file: Path): MutableMap { do { i++ if (i >= lines.size) break - value += lines[i].dropLast(1) + '\n' - } while (lines[i].endsWith('\\')) + value += lines[i].dropLast(1) + val continuation = lines[i].endsWith('\\') + if (continuation) value += '\n' + } while (continuation) } settings[line.substring(0, index)] = value }