Skip to content

Commit 4342a97

Browse files
committed
Add evil-want-treat-composed-chars-as-one option
Allows user to disable special handling of composed characters. See the docstring for more information.
1 parent ca27fcf commit 4342a97

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

evil-common.el

+8-7
Original file line numberDiff line numberDiff line change
@@ -3000,13 +3000,14 @@ the positions to be outside of this sequence."
30003000
(when (and (numberp beg) (numberp end))
30013001
(setq beg-out (min beg end))
30023002
(setq end-out (max beg end))
3003-
(let ((comp (find-composition beg-out)))
3004-
;; find-composition returns (FROM TO VALID-P)
3005-
(when (and (listp comp) (nth 2 comp))
3006-
(setq beg-out (nth 0 comp))))
3007-
(let ((comp (find-composition end-out)))
3008-
(when (and (listp comp) (nth 2 comp))
3009-
(setq end-out (nth 1 comp))))
3003+
(when evil-want-treat-composed-chars-as-one
3004+
(let ((comp (find-composition beg-out)))
3005+
;; find-composition returns (FROM TO VALID-P)
3006+
(when (and (listp comp) (nth 2 comp))
3007+
(setq beg-out (nth 0 comp))))
3008+
(let ((comp (find-composition end-out)))
3009+
(when (and (listp comp) (nth 2 comp))
3010+
(setq end-out (nth 1 comp)))))
30103011
(append (list beg-out end-out)
30113012
(when (evil-type-p type)
30123013
(list type))

evil-vars.el

+13
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,19 @@ without having to introduce new niche functionality.
11041104
Prefer to set `evil-v$-excludes-newline' to non-nil."
11051105
"1.15.0")
11061106

1107+
(defcustom evil-want-treat-composed-chars-as-one nil
1108+
"EXPERIMENTAL. Treat composed characters as single characters.
1109+
1110+
Composed characters are sequences of characters in the buffer
1111+
that are displayed as a single glyph. This is the device used by
1112+
`prettify-symbols-mode' among others. This option tells evil that
1113+
these sequences of characters should be treated as a single unit
1114+
to, for example, prevent part of the sequence from being deleted
1115+
by an evil command. It alters low-level functionality of evil and
1116+
is considered experimental."
1117+
:type 'boolean
1118+
:group 'evil)
1119+
11071120
(defcustom evil-v$-excludes-newline nil
11081121
"If non-nil, `evil-end-of-line' does not move as far as to include
11091122
the `\n' char at eol. This makes `v$' consistent with `$' used as a

0 commit comments

Comments
 (0)