Commit f8e2c40c authored by Karl Heuer's avatar Karl Heuer
Browse files

(show-paren-function): Handle multibyte characters.

parent 51a02226
...@@ -104,7 +104,7 @@ after `show-paren-delay' seconds of Emacs idle time." ...@@ -104,7 +104,7 @@ after `show-paren-delay' seconds of Emacs idle time."
(let ((beg (min pos oldpos)) (end (max pos oldpos))) (let ((beg (min pos oldpos)) (end (max pos oldpos)))
(and (/= (char-syntax (char-after beg)) ?\$) (and (/= (char-syntax (char-after beg)) ?\$)
(setq mismatch (setq mismatch
(not (eq (char-after (1- end)) (not (eq (char-before end)
;; This can give nil. ;; This can give nil.
(matching-paren (char-after beg)))))))) (matching-paren (char-after beg))))))))
;; If they don't properly match, use a different face, ;; If they don't properly match, use a different face,
...@@ -137,9 +137,9 @@ after `show-paren-delay' seconds of Emacs idle time." ...@@ -137,9 +137,9 @@ after `show-paren-delay' seconds of Emacs idle time."
;; highlight the paren at point to indicate misbalance. ;; highlight the paren at point to indicate misbalance.
(let ((from (if (= dir 1) (let ((from (if (= dir 1)
(point) (point)
(1- (point)))) (forward-point -1)))
(to (if (= dir 1) (to (if (= dir 1)
(1+ (point)) (forward-point 1)
(point)))) (point))))
(if show-paren-overlay-1 (if show-paren-overlay-1
(move-overlay show-paren-overlay-1 (move-overlay show-paren-overlay-1
...@@ -157,11 +157,15 @@ after `show-paren-delay' seconds of Emacs idle time." ...@@ -157,11 +157,15 @@ after `show-paren-delay' seconds of Emacs idle time."
;; If it's an unmatched paren, turn off any such highlighting. ;; If it's an unmatched paren, turn off any such highlighting.
(or (and (not (integerp pos)) (or (and (not (integerp pos))
(delete-overlay show-paren-overlay)) (delete-overlay show-paren-overlay))
(if show-paren-overlay (save-excursion
(move-overlay show-paren-overlay (- pos dir) pos (goto-char pos)
(current-buffer)) (if show-paren-overlay
(setq show-paren-overlay (move-overlay show-paren-overlay
(make-overlay (- pos dir) pos)))) (forward-point (- dir))
pos
(current-buffer))
(setq show-paren-overlay
(make-overlay (forward-point (- dir)) pos)))))
;; Always set the overlay face, since it varies. ;; Always set the overlay face, since it varies.
(overlay-put show-paren-overlay 'face face)) (overlay-put show-paren-overlay 'face face))
(t (t
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment