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

pull/3316/head
Junyi Du 2021-11-29 16:59:28 +08:00 committed by Tienson Qin
parent b4dbf1a04c
commit 1ae8087ae3
1 changed files with 3 additions and 1 deletions

View File

@ -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]