Skip to content

Commit ecab7d6

Browse files
authored
Fix #49: bug with hitting backspace after line comment (#51)
1 parent bddb64f commit ecab7d6

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
- Bump squint to 0.7.105
6+
- Fix [#49](https://github.com/nextjournal/clojure-mode/issues/49): bug with hitting backspace after line comment
7+
38
## 0.3.1
49

510
- Fix [#45](https://github.com/nextjournal/clojure-mode/issues/45): cursor after Discard node should evaluate child

src-shared/nextjournal/clojure_mode/extensions/close_brackets.cljc

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
(j/fn [^:js {:keys [from to head anchor empty]}]
7575
(cond
7676
(in-string? state from)
77-
(if (= open \")
77+
(if (= \" open)
7878
(u/insertion head "\\\"")
7979
(u/insertion from to open))
8080
;; allow typing escaped bracket

src-shared/nextjournal/clojure_mode/util.cljc

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
(defn line-content-at [state from]
5050
(-> state
5151
(j/call-in [:doc :lineAt] from)
52-
(j/call :slice)))
52+
(j/get :text)))
5353

5454
(defn map-cursor [^js original-range ^js state update-map]
5555
{:pre [(map? update-map)]}

test/nextjournal/clojure_mode_tests.cljc

+2
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@
123123
"\"| \"" "\"| \"" ;; do not delete string with whitespace
124124
":x :a |" ":x :a|" ;; do not format on backspace
125125
"\"[|]\"" "\"|]\"" ;; normal deletion inside strings
126+
"( ;;\n|)" "( ;;|\n)" ;; don't put paren behind line comment
127+
"( ;|\n)" "( |\n)"
126128
))
127129

128130
#?(:squint nil

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-
squint-cljs@0.4.81:
1180-
version "0.4.81"
1181-
resolved "https://registry.yarnpkg.com/squint-cljs/-/squint-cljs-0.4.81.tgz#b1926c112a5caa12ed4ecc6f9035827dc4270bb7"
1182-
integrity sha512-ffMxWbL901+xHMlaXeUavfrhK+uX7tsZYzF9/kxJYGZ6+KLOGy1Ke9+osbVNR+Vd/uszX6O/YcpNxCJzThgTUA==
1179+
squint-cljs@0.7.105:
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==
11831183
dependencies:
11841184
chokidar "^3.5.3"
11851185

0 commit comments

Comments
 (0)