changeset 91803:78fbdbd37286

(casify_region): Only call after-change and composition functions on the part of the region that was changed.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 12 Feb 2008 21:25:45 +0000
parents 3a35316b344f
children d2dce25da0cb
files src/ChangeLog src/casefiddle.c
diffstat 2 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Feb 12 21:21:02 2008 +0000
+++ b/src/ChangeLog	Tue Feb 12 21:25:45 2008 +0000
@@ -1,5 +1,8 @@
 2008-02-12  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* casefiddle.c (casify_region): Only call after-change and composition
+	functions on the part of the region that was changed.
+
 	* keyboard.c (read_avail_input):
 	* frame.c (Fdelete_frame): Call Fdelete_terminal.
 
--- a/src/casefiddle.c	Tue Feb 12 21:21:02 2008 +0000
+++ b/src/casefiddle.c	Tue Feb 12 21:25:45 2008 +0000
@@ -179,11 +179,11 @@
   register int c;
   register int inword = flag == CASE_DOWN;
   register int multibyte = !NILP (current_buffer->enable_multibyte_characters);
-  int start, end;
-  int start_byte, end_byte;
-  int changed = 0;
-  int opoint = PT;
-  int opoint_byte = PT_BYTE;
+  EMACS_INT start, end;
+  EMACS_INT start_byte, end_byte;
+  EMACS_INT first = -1, last;	/* Position of first and last changes.  */
+  EMACS_INT opoint = PT;
+  EMACS_INT opoint_byte = PT_BYTE;
 
   if (EQ (b, e))
     /* Not modifying because nothing marked */
@@ -226,7 +226,10 @@
 	inword = ((SYNTAX (c) == Sword) && (inword || !SYNTAX_PREFIX (c)));
       if (c != c2)
 	{
-	  changed = 1;
+	  last = start;
+	  if (first < 0)
+	    first = start;
+
 	  if (! multibyte)
 	    {
 	      MAKE_CHAR_UNIBYTE (c);
@@ -266,11 +269,10 @@
   if (PT != opoint)
     TEMP_SET_PT_BOTH (opoint, opoint_byte);
 
-  if (changed)
+  if (first >= 0)
     {
-      start = XFASTINT (b);
-      signal_after_change (start, end - start, end - start);
-      update_compositions (start, end, CHECK_ALL);
+      signal_after_change (first, last + 1 - first, last + 1 - first);
+      update_compositions (first, last + 1, CHECK_ALL);
     }
 }