[AC] More fixes about face indexes

Didier Verna didier at xemacs.org
Wed Sep 26 09:28:14 EDT 2007


NOTE: This patch has been committed. The version below is
informational only (whitespace differences have been removed).

		Dear reviewers,

here are more fixes similar to the ones in my previous patch.	


src/ChangeLog addition:

2007-09-26  Didier Verna  <didier at xemacs.org>

	More fixes similar to previous patch:

	* faces.c (reset_face_cachels): Add informative comment about the
	order of faces cache addition.
	* redisplay.h: Ditto.
	* redisplay-output.c (output_display_line): Don't rely on
	DEFAULT_INDEX being 0.
	* redisplay.c (create_string_text_block): Ditto.


XEmacs source patch:
Diff command:   cvs -q diff -u -t -b -B -w
Files affected: src/redisplay.h src/redisplay.c src/redisplay-output.c src/faces.c

Index: src/faces.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/faces.c,v
retrieving revision 1.55
diff -u -u -t -b -B -w -r1.55 faces.c
--- src/faces.c	22 Apr 2007 19:58:59 -0000	1.55
+++ src/faces.c	26 Sep 2007 13:24:16 -0000
@@ -1592,6 +1592,10 @@
             Dynarr_free (cachel->merged_faces);
         }
       Dynarr_reset (w->face_cachels);
+      /* #### NOTE: be careful with the order !
+         The cpp macros DEFAULT_INDEX and MODELINE_INDEX defined in
+         redisplay.h depend on the code below, which is really clumsy.
+         -- dvl */
       get_builtin_face_cache_index (w, Vdefault_face);
       get_builtin_face_cache_index (w, Vmodeline_face);
       XFRAME (w->frame)->window_face_cache_reset = 1;
Index: src/redisplay-output.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/redisplay-output.c,v
retrieving revision 1.27
diff -u -u -t -b -B -w -r1.27 redisplay-output.c
--- src/redisplay-output.c	27 Jun 2006 22:59:40 -0000	1.27
+++ src/redisplay-output.c	26 Sep 2007 13:24:16 -0000
@@ -795,18 +795,19 @@
 
                   if (x < ddl->bounds.left_in)
                     {
-                      findex = ddl->left_margin_findex ?
+                      findex = (ddl->left_margin_findex > DEFAULT_INDEX) ?
                         ddl->left_margin_findex
                         : get_builtin_face_cache_index (w, Vleft_margin_face);
                     }
                   else if (x < ddl->bounds.right_in)
                     {
-                      /* no check here because DEFAULT_INDEX == 0 anyway */
-                      findex = ddl->default_findex;
+                      findex = (ddl->default_findex >= DEFAULT_INDEX) ?
+                        ddl->default_findex
+: DEFAULT_INDEX;
                     }
                   else if (x < ddl->bounds.right_out)
                     {
-                      findex = ddl->right_margin_findex ?
+                      findex = (ddl->right_margin_findex > DEFAULT_INDEX) ?
                         ddl->right_margin_findex
                         : get_builtin_face_cache_index (w, Vright_margin_face);
                     }
Index: src/redisplay.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/redisplay.c,v
retrieving revision 1.101
diff -u -u -t -b -B -w -r1.101 redisplay.c
--- src/redisplay.c	5 Nov 2006 22:31:45 -0000	1.101
+++ src/redisplay.c	26 Sep 2007 13:24:17 -0000
@@ -4680,10 +4680,9 @@
   dl->num_chars = 0;
   dl->line_continuation = 0;
 
-  /* set up faces to use for clearing areas, used by
-     output_display_line */
+  /* Set up faces to use for clearing areas, used by output_display_line. */
   dl->default_findex = default_face;
-  if (default_face)
+  if (default_face > DEFAULT_INDEX)
     {
       dl->left_margin_findex = default_face;
       dl->right_margin_findex = default_face;
Index: src/redisplay.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/redisplay.h,v
retrieving revision 1.23
diff -u -u -t -b -B -w -r1.23 redisplay.h
--- src/redisplay.h	9 Mar 2005 19:47:41 -0000	1.23
+++ src/redisplay.h	26 Sep 2007 13:24:17 -0000
@@ -81,6 +81,8 @@
 #define NEXT_CURSOR     3
 #define IGNORE_CURSOR   4
 
+/* #### NOTE: these indexes depend on the order in which the faces are added
+   to the cache in the function reset_face_cachels. */
 #define DEFAULT_INDEX   (face_index) 0
 #define MODELINE_INDEX  (face_index) 1
 

-- 
New @-quartet featured CD Review !!
http://www.indie-music.com/modules.php?name=News&file=article&sid=6457

Didier Verna, didier at lrde.epita.fr, http://www.lrde.epita.fr/~didier

EPITA / LRDE, 14-16 rue Voltaire   Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-Bicêtre, France   Fax.+33 (1) 53 14 59 22   didier at xemacs.org



More information about the XEmacs-Patches mailing list