Skip to content

Commit b975d8c

Browse files
authored
Addendum for #49 (#52)
1 parent 16f0b6c commit b975d8c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Diff for: src-shared/nextjournal/clojure_mode/extensions/close_brackets.cljc

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515
(= \\ (.. state -doc (slice (max 0 (dec pos)) pos) toString)))
1616

1717
(defn backspace-backoff [state from to]
18+
#_(js/console.log (some-> (n/|node state from) (u/guard n/line-comment?)))
1819
(if
1920
;; handle line-comments (backspace should not drag forms up into line comments)
2021
(and
21-
;; we are directly in front of a line-comment
22+
;; we are directly in right of a line-comment
2223
(some-> (n/node| state (dec from)) (u/guard n/line-comment?))
23-
;; current line is blank
24-
(not (str/blank? (u/line-content-at state from))))
24+
;; current line is blank or we're left of a line-comment
25+
(not (or (str/blank? (u/line-content-at state from))
26+
(some-> (n/|node state from) (u/guard n/line-comment?)))))
2527
{:cursor (dec from)}
2628
(u/deletion from to)))
2729

Diff for: test/nextjournal/clojure_mode_tests.cljc

+1-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@
125125
"\"[|]\"" "\"|]\"" ;; normal deletion inside strings
126126
"( ;;\n|)" "( ;;|\n)" ;; don't put paren behind line comment
127127
"( ;|\n)" "( |\n)"
128-
"(;;\n|;;\n)" "(;;|\n;;\n)"
129-
))
128+
"(;;\n|;;\n)" "(;;|;;\n)"))
130129

131130
#?(:squint nil
132131
:cljs (testing "handle backspace (embedded)"

0 commit comments

Comments
 (0)