From c5790669a755a2ccb8788504a06420fd4e2d0572 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 10 Jun 2024 15:11:06 +0200 Subject: [PATCH] slurp backwards --- src-shared/nextjournal/clojure_mode/commands.cljc | 6 +++--- test/nextjournal/clojure_mode_tests.cljc | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src-shared/nextjournal/clojure_mode/commands.cljc b/src-shared/nextjournal/clojure_mode/commands.cljc index e07bb6a..dc41f85 100644 --- a/src-shared/nextjournal/clojure_mode/commands.cljc +++ b/src-shared/nextjournal/clojure_mode/commands.cljc @@ -167,9 +167,9 @@ -1 (let [^string edge (n/left-edge-with-prefix state parent) start (n/start (n/with-prefix parent))] - [{:from start - :to (+ start (count edge)) - :insert " "} + [(cond-> {:from start + :to (+ start (count edge))} + (not str?) (j/assoc! :insert " ")) {:from (n/start target) :insert edge}]))})))))))) diff --git a/test/nextjournal/clojure_mode_tests.cljc b/test/nextjournal/clojure_mode_tests.cljc index 7113f1f..0909b3c 100644 --- a/test/nextjournal/clojure_mode_tests.cljc +++ b/test/nextjournal/clojure_mode_tests.cljc @@ -273,7 +273,8 @@ "('xy|z 1) 2" 1 "('xy|z 1 2)" "'ab|c 1" 1 "'ab|c 1" - "\"x|\" 1" 1 "\"x| 1\"")) + "\"x|\" 1" 1 "\"x| 1\"" + "1 \"x|\"" -1 "\"1 x|\"")) #?(:squint nil :cljs