emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113890: Fix bug #15099 with 'box' face attribute in


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r113890: Fix bug #15099 with 'box' face attribute in display tables.
Date: Thu, 15 Aug 2013 15:29:10 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113890
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15099
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Thu 2013-08-15 18:28:53 +0300
message:
  Fix bug #15099 with 'box' face attribute in display tables.
  
   src/xdisp.c (next_element_from_display_vector): Support 'box' face attribute
   in the face definitions of a display vector.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-08-15 15:20:03 +0000
+++ b/src/ChangeLog     2013-08-15 15:28:53 +0000
@@ -6,6 +6,8 @@
        visible character of the display line.  This avoids funky
        horizontal shifting because the window start is not kept on the
        same position.  (Bug#15090)
+       (next_element_from_display_vector): Support 'box' face attribute
+       in the face definitions of a display vector.  (Bug#15099)
 
 2013-08-15  Lars Magne Ingebrigtsen  <address@hidden>
 

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-08-15 15:20:03 +0000
+++ b/src/xdisp.c       2013-08-15 15:28:53 +0000
@@ -7461,6 +7461,8 @@
 next_element_from_display_vector (struct it *it)
 {
   Lisp_Object gc;
+  int prev_face_id = it->face_id;
+  int next_face_id;
 
   /* Precondition.  */
   eassert (it->dpvec && it->current.dpvec_index >= 0);
@@ -7473,6 +7475,8 @@
 
   if (GLYPH_CODE_P (gc))
     {
+      struct face *this_face, *prev_face, *next_face;
+
       it->c = GLYPH_CODE_CHAR (gc);
       it->len = CHAR_BYTES (it->c);
 
@@ -7488,6 +7492,42 @@
            it->face_id = merge_faces (it->f, Qt, lface_id,
                                       it->saved_face_id);
        }
+
+      /* Glyphs in the display vector could have the box face, so we
+        need to set the related flags in the iterator, as
+        appropriate.  */
+      this_face = FACE_FROM_ID (it->f, it->face_id);
+      prev_face = FACE_FROM_ID (it->f, prev_face_id);
+
+      /* Is this character the first character of a box-face run?  */
+      it->start_of_box_run_p = (this_face && this_face->box != FACE_NO_BOX
+                               && (!prev_face
+                                   || prev_face->box == FACE_NO_BOX));
+
+      /* For the last character of the box-face run, we need to look
+        either at the next glyph from the display vector, or at the
+        face we saw before the display vector.  */
+      if (it->current.dpvec_index < it->dpend - it->dpvec - 1)
+       {
+         if (it->dpvec_face_id >= 0)
+           next_face_id = it->dpvec_face_id;
+         else
+           {
+             int lface_id =
+               GLYPH_CODE_FACE (it->dpvec[it->current.dpvec_index + 1]);
+
+             if (lface_id > 0)
+               next_face_id = merge_faces (it->f, Qt, lface_id,
+                                           it->saved_face_id);
+           }
+       }
+      else
+       next_face_id = it->saved_face_id;
+      next_face = FACE_FROM_ID (it->f, next_face_id);
+      it->end_of_box_run_p = (this_face && this_face->box != FACE_NO_BOX
+                             && (!next_face
+                                 || next_face->box == FACE_NO_BOX));
+      it->face_box_p = this_face && this_face->box != FACE_NO_BOX;
     }
   else
     /* Display table entry is invalid.  Return a space.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]