Skip to content

Commit f15ab7a

Browse files
committed
ref: better input source when deactivating inline overlay
1 parent e097288 commit f15ab7a

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

sis.el

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,16 +1391,20 @@ If POSITION is not provided, then default to be the current position."
13911391
sis-inline-mode
13921392
sis-inline-mode)
13931393

1394+
(defsubst sis--evil-not-insert-state-p ()
1395+
"In Evil but not at insert state."
1396+
(and (featurep 'evil)
1397+
(or (evil-normal-state-p)
1398+
(evil-visual-state-p)
1399+
(evil-motion-state-p)
1400+
(evil-operator-state-p))))
1401+
13941402
(defsubst sis--inline-effect-space-inserted-p ()
1395-
"A effective space is inserted."
1403+
"An effective space is inserted."
13961404
(and sis-inline-mode
13971405
(not (overlayp sis--inline-overlay))
13981406
(not (button-at (point)))
1399-
(not (and (featurep 'evil)
1400-
(or (evil-normal-state-p)
1401-
(evil-visual-state-p)
1402-
(evil-motion-state-p)
1403-
(evil-operator-state-p))))
1407+
(not (sis--evil-not-insert-state-p))
14041408
;; around char is <spc> <DBC spc>
14051409
(memq (preceding-char) (list ?\s 12288))))
14061410

@@ -1524,9 +1528,13 @@ START: start position of the inline region."
15241528
(let* ((back-detect (sis--back-detect-chars))
15251529
(back-to (sis-back-detect-to back-detect))
15261530
(back-char (sis-back-detect-char back-detect)))
1527-
1528-
15291531
(cond
1532+
(;if in evil but not insert state
1533+
(sis--evil-not-insert-state-p)
1534+
(sis-set-english))
1535+
(;if cursor is not at the end of the overlay
1536+
(/= (point) (sis--inline-overlay-end)
1537+
(sis-context))
15301538
(; inline english region
15311539
(eq sis--inline-lang 'english)
15321540
(sis-set-other))

0 commit comments

Comments
 (0)