fix: only show perperty search when current line is wrapped by . #6146

This commit is contained in:
maxweilun1989
2022-07-26 12:17:43 +08:00
committed by Tienson Qin
parent a1ca6820df
commit d12437722d

View File

@@ -1827,7 +1827,8 @@
pos (cursor/pos input)
last-input-char (util/nth-safe (.-value input) (dec pos))
last-prev-input-char (util/nth-safe (.-value input) (dec (dec pos)))
prev-prev-input-char (util/nth-safe (.-value input) (- pos 3))]
prev-prev-input-char (util/nth-safe (.-value input) (- pos 3))
current-line (text-util/get-current-line-by-pos (.-value input) (dec pos))]
;; TODO: is it cross-browser compatible?
;; (not= (gobj/get native-e "inputType") "insertFromPaste")
@@ -1854,8 +1855,8 @@
(and
(not= :property-search (state/get-editor-action))
(or (wrapped-by? input "" "::")
(wrapped-by? input "\n" "::")))
(or (text-util/wrapped-by? current-line (dec pos) "" "::")
(text-util/wrapped-by? current-line (dec pos) "\n" "::")))
(do
(state/set-editor-action-data! {:pos (cursor/get-caret-pos input)})
(state/set-editor-action! :property-search))