1
0
Эх сурвалжийг харах

fix: DWIM isn't activated at one-line block

Junyi Du 3 жил өмнө
parent
commit
1ae8087ae3

+ 3 - 1
src/main/frontend/util/cursor.cljs

@@ -91,7 +91,9 @@
   [input]
   (let [[content pos] (get-input-content&pos input)]
     (if (zero? pos) 0
-        (inc (string/last-index-of content \newline (dec pos))))))
+        (let [last-newline-pos (string/last-index-of content \newline (dec pos))]
+          (if (= nil last-newline-pos) 0 ;; no newline found (first line)
+              (inc last-newline-pos))))))
 
 (defn line-end-pos
   [input]