mirror of
https://github.com/logseq/logseq.git
synced 2026-04-28 16:15:21 +00:00
Improve backtick autopairing (#6496)
* If you type a backtick and then some letters and then another backtick, the last backtick should close the first one and not spawn another autopair
This commit is contained in:
@@ -2720,9 +2720,15 @@
|
||||
(do (util/stop e)
|
||||
(autopair input-id "(" format nil))
|
||||
|
||||
;; If you type `xyz`, the last backtick should close the first and not add another autopair
|
||||
;; If you type several backticks in a row, each one should autopair to accommodate multiline code (```)
|
||||
(contains? (set (keys autopair-map)) key)
|
||||
(do (util/stop e)
|
||||
(autopair input-id key format nil))
|
||||
(let [curr (get-current-input-char input)
|
||||
prev (util/nth-safe value (dec pos))]
|
||||
(util/stop e)
|
||||
(if (and (= key "`") (= "`" curr) (not= "`" prev))
|
||||
(cursor/move-cursor-forward input)
|
||||
(autopair input-id key format nil)))
|
||||
|
||||
(and hashtag? (or (zero? pos) (re-matches #"\s" (get value (dec pos)))))
|
||||
(do
|
||||
|
||||
Reference in New Issue
Block a user