File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 68
68
{:node c
69
69
:position [row (+ col (node/leader-length node))]
70
70
:parent loc
71
- :path {:l []
72
- :pnodes (if path (conj (:pnodes path) node) [node])
73
- :ppath path
71
+ :path {:l []
72
+ :ppath path
74
73
:r cnext}}))))
75
74
76
75
(defn up
77
76
" Returns the loc of the parent of the node at this loc, or nil if at
78
77
the top"
79
78
[loc]
80
- (let [{:keys [node parent position] {:keys [l ppath pnodes r changed?]} :path } loc]
79
+ (let [{:keys [node parent position] {:keys [l ppath r changed?]} :path } loc]
81
80
(when parent
82
81
(if changed?
83
- {:node (make-node loc (peek pnodes ) (concat l (cons node r)))
82
+ {:node (make-node loc (:node parent ) (concat l (cons node r)))
84
83
:path (and ppath (assoc ppath :changed? true ))
85
84
:parent (:parent parent)
86
85
:position position}
219
218
" Removes the node at loc, returning the loc that would have preceded
220
219
it in a depth-first walk."
221
220
[loc]
222
- (let [{:keys [node parent position] {:keys [l ppath pnodes r] :as path} :path } loc]
221
+ (let [{:keys [node parent position] {:keys [l ppath r] :as path} :path } loc]
223
222
(if (nil? path)
224
223
(throw (new Exception " Remove at top" ))
225
224
(if (pos? (count l))
230
229
(if-let [child (and (branch? loc) (down loc))]
231
230
(recur (rightmost child))
232
231
loc))
233
- {:node (make-node loc (peek pnodes ) r)
232
+ {:node (make-node loc (:node parent ) r)
234
233
:path (and ppath (assoc ppath :changed? true ))
235
234
:parent (:parent parent)
236
235
:position position}))))
You can’t perform that action at this time.
0 commit comments