Skip to content

Commit 74872bf

Browse files
committed
Respect modifier setting for eval-region highlight
1 parent ac038eb commit 74872bf

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/nextjournal/clojure_mode/extensions/eval_region.cljs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@
7979
(j/lit
8080
{:create (constantly (.-none Decoration))
8181
:update (j/fn [_value ^:js {:keys [state]}]
82-
(let [{:strs [Alt Shift Enter]} (get-modifier-field state)
82+
(let [{:as field :strs [Shift Enter modifier]} (get-modifier-field state)
83+
modifier-pressed? (get field modifier)
8384
spec (if Enter mark-spec-highlight mark-spec)]
8485
(if-some [range (when (or (n/embedded? state) (n/within-program? state))
85-
(cond (and Alt Shift) (top-level-node state)
86-
Alt (or (u/guard (main-selection state) #(not (j/get % :empty)))
87-
(cursor-range state))))]
86+
(cond (and modifier-pressed? Shift) (top-level-node state)
87+
modifier-pressed? (or (u/guard (main-selection state) #(not (j/get % :empty)))
88+
(cursor-range state))))]
8889
(single-mark spec range)
8990
(.-none Decoration))))})))
9091

@@ -106,7 +107,7 @@
106107
handle-key-event (j/fn [^:js {:as event :keys [altKey shiftKey metaKey controlKey type]}
107108
^:js {:as view :keys [state]}]
108109
(let [prev (get-modifier-field state)
109-
next (cond-> {}
110+
next (cond-> {"modifier" modifier}
110111
altKey (assoc "Alt" true)
111112
shiftKey (assoc "Shift" true)
112113
metaKey (assoc "Meta" true)

0 commit comments

Comments
 (0)