mirror of
https://github.com/logseq/logseq.git
synced 2026-04-25 14:44:53 +00:00
fix(editor): incorrect behavior of the delete key for deleting the last char
This commit is contained in:
@@ -14,13 +14,17 @@
|
||||
(is (= 3 (util/safe-dec-current-pos-from-end "abc😀" 5)))
|
||||
(is (= 0 (util/safe-dec-current-pos-from-end "😀" 2)))
|
||||
(is (= 4 (util/safe-dec-current-pos-from-end "abcde" 5)))
|
||||
(is (= 1 (util/safe-dec-current-pos-from-end "中文" 2))))
|
||||
(is (= 1 (util/safe-dec-current-pos-from-end "中文" 2)))
|
||||
(is (= 0 (util/safe-dec-current-pos-from-end "中" 1)))
|
||||
(is (= 0 (util/safe-dec-current-pos-from-end "a" 1))))
|
||||
|
||||
(testing "safe current position from start for emoji"
|
||||
(is (= 5 (util/safe-inc-current-pos-from-start "abc😀d" 3)))
|
||||
(is (= 2 (util/safe-inc-current-pos-from-start "😀" 0)))
|
||||
(is (= 2 (util/safe-inc-current-pos-from-start "abcde" 1)))
|
||||
(is (= 1 (util/safe-inc-current-pos-from-start "中文" 0)))))
|
||||
(is (= 1 (util/safe-inc-current-pos-from-start "中文" 0)))
|
||||
(is (= 2 (util/safe-inc-current-pos-from-start "😀" 0)))
|
||||
(is (= 1 (util/safe-inc-current-pos-from-start "中" 0)))
|
||||
(is (= 1 (util/safe-inc-current-pos-from-start "a" 0)))))
|
||||
|
||||
(deftest test-memoize-last
|
||||
(testing "memoize-last add test"
|
||||
|
||||
Reference in New Issue
Block a user