From 2e19e8ca4214bb90e785cb853797b1ece9b1f223 Mon Sep 17 00:00:00 2001 From: sergeych Date: Tue, 11 Apr 2023 13:20:34 +0100 Subject: [PATCH] 0.0.6-SNAPSHOT fixed block indexes in merge3 result --- build.gradle.kts | 2 +- kotlin-js-store/yarn.lock | 23 +++++++++++++++++++ .../kotlin/net.sergeych.merge3/merge3.kt | 7 +++++- src/commonTest/kotlin/testMerge.kt | 4 ++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index eaeb7da..836a946 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } group = "net.sergeych" -version = "0.0.5-SNAPSHOT" +version = "0.0.6-SNAPSHOT" repositories { mavenCentral() diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock index 90b0f62..a0adb4d 100644 --- a/kotlin-js-store/yarn.lock +++ b/kotlin-js-store/yarn.lock @@ -52,6 +52,11 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" +"@js-joda/core@3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@js-joda/core/-/core-3.2.0.tgz#3e61e21b7b2b8a6be746df1335cf91d70db2a273" + integrity sha512-PMqgJ0sw5B7FKb2d5bWYIoxjri+QlW/Pys7+Rw82jSH0QN3rB05jZ/VrrsUdh1w4+i2kw9JOejXGq/KhDOX7Kg== + "@socket.io/component-emitter@~3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz#96116f2a912e0c02817345b3c10751069920d553" @@ -598,6 +603,14 @@ dom-serialize@^2.2.1: extend "^3.0.0" void-elements "^2.0.0" +dukat@0.5.8-rc.4: + version "0.5.8-rc.4" + resolved "https://registry.yarnpkg.com/dukat/-/dukat-0.5.8-rc.4.tgz#90384dcb50b14c26f0e99dae92b2dea44f5fce21" + integrity sha512-ZnMt6DGBjlVgK2uQamXfd7uP/AxH7RqI0BL9GLrrJb2gKdDxvJChWy+M9AQEaL+7/6TmxzJxFOsRiInY9oGWTA== + dependencies: + google-protobuf "3.12.2" + typescript "3.9.5" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -862,6 +875,11 @@ glob@^7.1.3, glob@^7.1.7: once "^1.3.0" path-is-absolute "^1.0.0" +google-protobuf@3.12.2: + version "3.12.2" + resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.12.2.tgz#50ce9f9b6281235724eb243d6a83e969a2176e53" + integrity sha512-4CZhpuRr1d6HjlyrxoXoocoGFnRYgKULgMtikMddA9ztRyYR59Aondv2FioyxWVamRo0rF2XpYawkTCBEQOSkA== + graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" @@ -1713,6 +1731,11 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" +typescript@3.9.5: + version "3.9.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" + integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== + ua-parser-js@^0.7.30: version "0.7.34" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.34.tgz#afb439e2e3e394bdc90080acb661a39c685b67d7" diff --git a/src/commonMain/kotlin/net.sergeych.merge3/merge3.kt b/src/commonMain/kotlin/net.sergeych.merge3/merge3.kt index e8676b1..a45cfa8 100644 --- a/src/commonMain/kotlin/net.sergeych.merge3/merge3.kt +++ b/src/commonMain/kotlin/net.sergeych.merge3/merge3.kt @@ -36,7 +36,12 @@ class MergeResult( start = r.endInclusive + 1 } if (start < merged.size) { - result.add(MergedBlock.Unchanged(merged.slice(start until merged.size), sourceIndices[start])) + result.add( + MergedBlock.Unchanged( + merged.slice(start until merged.size), + sourceIndices.indexOf(start) + ) + ) } result } diff --git a/src/commonTest/kotlin/testMerge.kt b/src/commonTest/kotlin/testMerge.kt index 7b9a253..6333d3d 100644 --- a/src/commonTest/kotlin/testMerge.kt +++ b/src/commonTest/kotlin/testMerge.kt @@ -84,6 +84,10 @@ class BasicTest { val b = "456 Hello".toList() val m = merge3(src, b, a, true) +// println(m.toTrace(src)) +// println(m.changedAreas) +// for( b in m.blocks ) +// println(b) val unchanged = m.blocks.last() as MergedBlock.Unchanged println(unchanged) assertEquals(0, unchanged.referenceIndex)