diff lisp/font-lock.el @ 664:6e99cc8c6ca5

[xemacs-hg @ 2001-09-18 05:04:26 by ben] fileio.c: Fix various C++ compile errors in Andy's recent code. callint.c, editfns.c, emacs.c, lread.c, redisplay-x.c: Fix sign-compare warnings. scrollbar-msw.c: Fix crash under MS Windows. See comment around line 223 for explanation. font-lock.el: fix problem when you insert a comment on the line before a line of code: if we use the following char, then when you hit backspace, the following line of code turns the comment color. configure.in: Don't use -Wshadow when compiling with g++ or you get buried in silly warnings. This patch was already applied but somehow got unapplied. Stephen?
author ben
date Tue, 18 Sep 2001 05:06:57 +0000
parents e62e90435c57
children 12095b04a9b6
line wrap: on
line diff
--- a/lisp/font-lock.el	Mon Sep 17 07:48:36 2001 +0000
+++ b/lisp/font-lock.el	Tue Sep 18 05:06:57 2001 +0000
@@ -1203,10 +1203,14 @@
 (defun font-lock-after-change-function (beg end old-len)
   (when font-lock-mode
     ;; treat deletions as if the following character (or previous, if
-    ;; there is no following) were inserted.  this is a bit of a hack
+    ;; there is no following) were inserted. (also use the previous
+    ;; character at end of line.  this avoids a problem when you
+    ;; insert a comment on the line before a line of code: if we use
+    ;; the following char, then when you hit backspace, the following
+    ;; line of code turns the comment color.) this is a bit of a hack
     ;; but allows us to use text properties for everything.
     (if (= beg end)
-	(cond ((/= end (point-max)) (setq end (1+ end)))
+	(cond ((not (eolp)) (setq end (1+ end)))
 	      ((/= beg (point-min)) (setq beg (1- beg)))
 	      (t nil)))
     (put-text-property beg end 'font-lock-pending t)