We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ff195b9 commit e114063Copy full SHA for e114063
src/rewrite_clj/zip/zip.clj
@@ -148,7 +148,8 @@
148
(throw (new Exception "Insert at top"))
149
(assoc loc
150
:changed? true
151
- :left (conj left [item position])))))
+ :left (conj left [item position])
152
+ :position (node/+extent position (node/extent item))))))
153
154
(defn insert-right
155
"Inserts the item as the right sibling of the node at this loc,
test/rewrite_clj/zip/zip_test.clj
@@ -82,3 +82,10 @@
82
z/down
83
(z/insert-right 'x)
84
z/position) => [1 2])
85
+
86
+(fact "z/insert-left fixes the position"
87
+ (-> (base/of-string "[hello world]")
88
+ z/down
89
+ z/right
90
+ (z/insert-left 'x)
91
+ z/position) => [1 8])
0 commit comments