Skip to content

Commit b4105f4

Browse files
committed
Fix slurp string
1 parent 71553ee commit b4105f4

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@lezer/highlight": "^1.0.0",
2424
"@lezer/lr": "^1.0.0",
2525
"@nextjournal/lezer-clojure": "1.0.0",
26-
"squint-cljs": "0.7.105",
26+
"squint-cljs": "0.7.111",
2727
"w3c-keyname": "^2.2.4"
2828
},
2929
"comments": {

src-shared/nextjournal/clojure_mode/commands.cljc

+9-11
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@
112112
(defn nav [dir]
113113
(fn [state]
114114
(u/update-ranges state
115-
(j/fn [^:js {:as range :keys [from to empty]}]
115+
(j/fn [^:js {:keys [from to empty]}]
116116
(if empty
117117
{:cursor (nav-position state from dir)}
118118
{:cursor (j/get (u/from-to from to) (case dir -1 :from 1 :to))})))))
119119

120120
(defn nav-select [dir]
121121
(fn [^js state]
122122
(u/update-ranges state
123-
(j/fn [^:js {:as range :keys [from to empty]}]
123+
(j/fn [^:js {:keys [from to empty]}]
124124
(if empty
125125
{:range (n/balanced-range state from (nav-position state from dir))}
126126
{:range (j/let [^:js {:keys [from to]} (u/from-to from to)]
@@ -158,22 +158,20 @@
158158
:changes (case direction
159159
1
160160
(let [edge (n/down-last parent)]
161-
[{:from (-> target n/end)
162-
:insert (n/name edge)}
161+
#js [#js {:from (-> target n/end)
162+
:insert (n/name edge)}
163163
(-> edge
164164
n/from-to
165165
(cond->
166166
(not str?) (j/assoc! :insert " ")))])
167167
-1
168168
(let [^string edge (n/left-edge-with-prefix state parent)
169169
start (n/start (n/with-prefix parent))]
170-
(prn :parent (n/string state parent) :str str?)
171-
[(cond-> {:from start
172-
:to (+ start (count edge))
173-
#_#_:insert " "}
174-
(not str?) (j/assoc! :insert " "))
175-
{:from (n/start target)
176-
:insert edge}]))}))))))))
170+
#js [(cond-> #js {:from start
171+
:to (+ start (count edge))}
172+
(not str?) (j/assoc! :insert " "))
173+
#js {:from (n/start target)
174+
:insert edge}]))}))))))))
177175

178176
(defn barf [direction]
179177
(fn [^js state]

test/nextjournal/scratch.cljs

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
[nextjournal.clojure-mode.extensions.eval-region :as eval-region]
55
[nextjournal.clojure-mode.test-utils :as test-utils]))
66

7-
(def extensions
8-
(.concat cm-clojure/default-extensions (eval-region/extension #js {})))
7+
(comment
8+
(def extensions
9+
(.concat cm-clojure/default-extensions (eval-region/extension #js {})))
910

10-
(def apply-f (partial test-utils/apply-f extensions))
11+
(def apply-f (partial test-utils/apply-f extensions))
1112

12-
(js/console.log "a ;; hello\n(|)")
13-
(js/console.log (apply-f (commands/slurp -1) "a ;; hello\n(|)"))
13+
(js/console.log "a ;; hello\n(|)")
14+
(js/console.log (apply-f (commands/slurp -1) "a ;; hello\n(|)")))
1415

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -1176,10 +1176,10 @@ source-map@^0.5.6:
11761176
resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz"
11771177
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
11781178

1179-
1180-
version "0.7.105"
1181-
resolved "https://registry.yarnpkg.com/squint-cljs/-/squint-cljs-0.7.105.tgz#848a588aaf5d19593b2d8b24bad026382435a4ff"
1182-
integrity sha512-YtnPewo1ZM5p9kaC6j/rNw4F/FzsLaAS61Vhikw6z6dRJvns/Y/3rwGcb8BCoD6Abx23/frlk0B4/xhedgCbUw==
1179+
1180+
version "0.7.111"
1181+
resolved "https://registry.yarnpkg.com/squint-cljs/-/squint-cljs-0.7.111.tgz#1441933ed7162d5590570875394c12b181db9427"
1182+
integrity sha512-BZSq3OxqdRN1xpIYBOWDI03tppaOLxtmapUDsS32ViKg2anu6fo44qh3qGAvXcapDwc1mkIS6A2y2GA+SgB2Rw==
11831183
dependencies:
11841184
chokidar "^3.5.3"
11851185

0 commit comments

Comments
 (0)