changeset 17009:3db0adbc5367

(show-paren-function): Handle multibyte characters.
author Karl Heuer <kwzh@gnu.org>
date Thu, 20 Feb 1997 05:48:19 +0000
parents 3a99b530ad9a
children b0a097ba0ec5
files lisp/paren.el
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/paren.el	Thu Feb 20 05:47:42 1997 +0000
+++ b/lisp/paren.el	Thu Feb 20 05:48:19 1997 +0000
@@ -104,7 +104,7 @@
 		    (let ((beg (min pos oldpos)) (end (max pos oldpos)))
 		      (and (/= (char-syntax (char-after beg)) ?\$)
 			   (setq mismatch
-				 (not (eq (char-after (1- end))
+				 (not (eq (char-before end)
 					  ;; This can give nil.
 					  (matching-paren (char-after beg))))))))
 		;; If they don't properly match, use a different face,
@@ -137,9 +137,9 @@
 		   ;; highlight the paren at point to indicate misbalance.
 		   (let ((from (if (= dir 1)
 				   (point)
-				 (1- (point))))
+				 (forward-point -1)))
 			 (to (if (= dir 1)
-				 (1+ (point))
+				 (forward-point 1)
 			       (point))))
 		     (if show-paren-overlay-1
 			 (move-overlay show-paren-overlay-1
@@ -157,11 +157,15 @@
 	       ;; If it's an unmatched paren, turn off any such highlighting.
 	       (or (and (not (integerp pos))
 			(delete-overlay show-paren-overlay))
-		   (if show-paren-overlay
-		       (move-overlay show-paren-overlay (- pos dir) pos
-				     (current-buffer))
-		     (setq show-paren-overlay
-			   (make-overlay (- pos dir) pos))))
+		   (save-excursion
+		     (goto-char pos)
+		     (if show-paren-overlay
+			 (move-overlay show-paren-overlay
+				       (forward-point (- dir))
+				       pos
+				       (current-buffer))
+		       (setq show-paren-overlay
+			     (make-overlay (forward-point (- dir)) pos)))))
 	       ;; Always set the overlay face, since it varies.
 	       (overlay-put show-paren-overlay 'face face))
 	      (t