Skip to content

Commit

Permalink
Add evil-treat-composed-chars-as-one option
Browse files Browse the repository at this point in the history
Allows user to disable special handling of composed characters. See the
docstring for more information.
  • Loading branch information
justbur committed Aug 23, 2022
1 parent ca27fcf commit a7def96
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
15 changes: 8 additions & 7 deletions evil-common.el
Original file line number Diff line number Diff line change
Expand Up @@ -3000,13 +3000,14 @@ the positions to be outside of this sequence."
(when (and (numberp beg) (numberp end))
(setq beg-out (min beg end))
(setq end-out (max beg end))
(let ((comp (find-composition beg-out)))
;; find-composition returns (FROM TO VALID-P)
(when (and (listp comp) (nth 2 comp))
(setq beg-out (nth 0 comp))))
(let ((comp (find-composition end-out)))
(when (and (listp comp) (nth 2 comp))
(setq end-out (nth 1 comp))))
(when evil-treat-composed-chars-as-one
(let ((comp (find-composition beg-out)))
;; find-composition returns (FROM TO VALID-P)
(when (and (listp comp) (nth 2 comp))
(setq beg-out (nth 0 comp))))
(let ((comp (find-composition end-out)))
(when (and (listp comp) (nth 2 comp))
(setq end-out (nth 1 comp)))))
(append (list beg-out end-out)
(when (evil-type-p type)
(list type))
Expand Down
13 changes: 13 additions & 0 deletions evil-vars.el
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,19 @@ without having to introduce new niche functionality.
Prefer to set `evil-v$-excludes-newline' to non-nil."
"1.15.0")

(defcustom evil-treat-composed-chars-as-one nil
"EXPERIMENTAL. Treat composed characters as single characters.
Composed characters are sequences of characters in the buffer
that are displayed as a single glyph. This is the device used by
`prettify-symbols-mode' among others. This option tells evil that
these sequences of characters should be treated as a single unit
to, for example, prevent part of the sequence from being deleted
by an evil command. It alters low-level functionality of evil and
is considered experimental."
:type 'boolean
:group 'evil)

(defcustom evil-v$-excludes-newline nil
"If non-nil, `evil-end-of-line' does not move as far as to include
the `\n' char at eol. This makes `v$' consistent with `$' used as a
Expand Down

0 comments on commit a7def96

Please sign in to comment.