fix(evil): handle edge cases of embrace

If the surround key is `\(`, the text should be surrounded as
`\( text \)`. The same for `\[` and `\{`.
This commit is contained in:
Quoc Huy Vu 2021-11-18 02:51:45 +01:00 committed by Henrik Lissner
parent dabca5d24e
commit c09777b36b

View file

@ -17,10 +17,11 @@
(let ((char (read-char "\\"))) (let ((char (read-char "\\")))
(if (eq char 27) (if (eq char 27)
(cons "" "") (cons "" "")
(let ((pair (+evil--embrace-get-pair (string char))) (let* ((pair (+evil--embrace-get-pair (string char)))
(text (if (sp-point-in-string) "\\\\%s" "\\%s"))) (escape (if (sp-point-in-string) "\\\\" "\\"))
(cons (format text (car pair)) (escape (format "\\1%s" (regexp-quote escape))))
(format text (cdr pair))))))) (cons (replace-regexp-in-string "^\\( *\\)" escape (car pair))
(replace-regexp-in-string "^\\( *\\)" escape (cdr pair)))))))
;;;###autoload ;;;###autoload
(defun +evil--embrace-latex () (defun +evil--embrace-latex ()