refactor: cursor positions

This commit is contained in:
Tienson Qin
2022-07-05 01:10:01 +08:00
parent 18c378f1b9
commit 7c7312d830
5 changed files with 135 additions and 138 deletions

View File

@@ -111,9 +111,10 @@
(defn beginning-of-line?
[input]
(let [[content pos] (get-input-content&pos input)]
(or (zero? pos)
(when-let [pre-char (subs content (dec pos) pos)]
(= pre-char \newline)))))
(when content
(or (zero? pos)
(when-let [pre-char (subs content (dec pos) pos)]
(= pre-char \newline))))))
(defn move-cursor-to-line-end
[input]