aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2016-03-22 20:16:42 +0200
committerEli Zaretskii2016-03-22 20:16:42 +0200
commit38a43f1a8f26f1ec8dbb9b2981f1d98f2b2bd228 (patch)
tree014aa6698481dba040c62963fa5e17f679db5110 /src
parent91e667692ba1362ca1334b8d58fd16c305ad5e2a (diff)
downloademacs-38a43f1a8f26f1ec8dbb9b2981f1d98f2b2bd228.tar.gz
emacs-38a43f1a8f26f1ec8dbb9b2981f1d98f2b2bd228.zip
Fix bug in displaying header line with a box face
* src/xdisp.c (get_next_display_element): Handle the case when a display string acquires the box face from an underlying string, not from the buffer. (Bug#23091)
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c61
1 files changed, 47 insertions, 14 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index d68244e6c9d..d6ee2de8f39 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7229,18 +7229,21 @@ get_next_display_element (struct it *it)
7229 { 7229 {
7230 ptrdiff_t ignore; 7230 ptrdiff_t ignore;
7231 int next_face_id; 7231 int next_face_id;
7232 bool text_from_string = false;
7233 /* Normally, the next buffer location is stored in
7234 IT->current.pos... */
7232 struct text_pos pos = it->current.pos; 7235 struct text_pos pos = it->current.pos;
7233 7236
7234 /* For a string from a display property, the next 7237 /* ...but for a string from a display property, the
7235 buffer position is stored in the 'position' 7238 next buffer position is stored in the 'position'
7236 member of the iteration stack slot below the 7239 member of the iteration stack slot below the
7237 current one, see handle_single_display_spec. By 7240 current one, see handle_single_display_spec. By
7238 contrast, it->current.pos was not yet updated 7241 contrast, it->current.pos was not yet updated to
7239 to point to that buffer position; that will 7242 point to that buffer position; that will happen
7240 happen in pop_it, after we finish displaying the 7243 in pop_it, after we finish displaying the current
7241 current string. Note that we already checked 7244 string. Note that we already checked above that
7242 above that it->sp is positive, so subtracting one 7245 it->sp is positive, so subtracting one from it is
7243 from it is safe. */ 7246 safe. */
7244 if (it->from_disp_prop_p) 7247 if (it->from_disp_prop_p)
7245 { 7248 {
7246 int stackp = it->sp - 1; 7249 int stackp = it->sp - 1;
@@ -7249,19 +7252,49 @@ get_next_display_element (struct it *it)
7249 while (stackp >= 0 7252 while (stackp >= 0
7250 && STRINGP ((it->stack + stackp)->string)) 7253 && STRINGP ((it->stack + stackp)->string))
7251 stackp--; 7254 stackp--;
7252 eassert (stackp >= 0); 7255 if (stackp < 0)
7253 pos = (it->stack + stackp)->position; 7256 {
7257 /* If no stack slot was found for iterating
7258 a buffer, we are displaying text from a
7259 string, most probably the mode line or
7260 the header line, and that string has a
7261 display string on some of its
7262 characters. */
7263 text_from_string = true;
7264 pos = it->stack[it->sp - 1].position;
7265 }
7266 else
7267 pos = (it->stack + stackp)->position;
7254 } 7268 }
7255 else 7269 else
7256 INC_TEXT_POS (pos, it->multibyte_p); 7270 INC_TEXT_POS (pos, it->multibyte_p);
7257 7271
7258 if (CHARPOS (pos) >= ZV) 7272 if (text_from_string)
7273 {
7274 Lisp_Object base_string = it->stack[it->sp - 1].string;
7275
7276 if (CHARPOS (pos) >= SCHARS (base_string) - 1)
7277 it->end_of_box_run_p = true;
7278 else
7279 {
7280 next_face_id
7281 = face_at_string_position (it->w, base_string,
7282 CHARPOS (pos), 0,
7283 &ignore, face_id, false);
7284 it->end_of_box_run_p
7285 = (FACE_FROM_ID (it->f, next_face_id)->box
7286 == FACE_NO_BOX);
7287 }
7288 }
7289 else if (CHARPOS (pos) >= ZV)
7259 it->end_of_box_run_p = true; 7290 it->end_of_box_run_p = true;
7260 else 7291 else
7261 { 7292 {
7262 next_face_id = face_at_buffer_position 7293 next_face_id =
7263 (it->w, CHARPOS (pos), &ignore, 7294 face_at_buffer_position (it->w, CHARPOS (pos), &ignore,
7264 CHARPOS (pos) + TEXT_PROP_DISTANCE_LIMIT, false, -1); 7295 CHARPOS (pos)
7296 + TEXT_PROP_DISTANCE_LIMIT,
7297 false, -1);
7265 it->end_of_box_run_p 7298 it->end_of_box_run_p
7266 = (FACE_FROM_ID (it->f, next_face_id)->box 7299 = (FACE_FROM_ID (it->f, next_face_id)->box
7267 == FACE_NO_BOX); 7300 == FACE_NO_BOX);