diff options
| author | Eli Zaretskii | 2013-08-15 18:28:53 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-08-15 18:28:53 +0300 |
| commit | 0542623943803e346aec839369e399e4b0ff43ad (patch) | |
| tree | 4b13d6244a7e0ceed25b12b4a4d331edf706aa62 /src | |
| parent | d39a3da6f3df4ff3c08e5b68fe629e10d1b8f3ea (diff) | |
| download | emacs-0542623943803e346aec839369e399e4b0ff43ad.tar.gz emacs-0542623943803e346aec839369e399e4b0ff43ad.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 40 |
2 files changed, 42 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1a83531ad10..77c37864b00 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | visible character of the display line. This avoids funky | 6 | visible character of the display line. This avoids funky |
| 7 | horizontal shifting because the window start is not kept on the | 7 | horizontal shifting because the window start is not kept on the |
| 8 | same position. (Bug#15090) | 8 | same position. (Bug#15090) |
| 9 | (next_element_from_display_vector): Support 'box' face attribute | ||
| 10 | in the face definitions of a display vector. (Bug#15099) | ||
| 9 | 11 | ||
| 10 | 2013-08-15 Lars Magne Ingebrigtsen <larsi@gnus.org> | 12 | 2013-08-15 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 11 | 13 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 8b72c58cd07..25a2ed23a97 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -7461,6 +7461,8 @@ static int | |||
| 7461 | next_element_from_display_vector (struct it *it) | 7461 | next_element_from_display_vector (struct it *it) |
| 7462 | { | 7462 | { |
| 7463 | Lisp_Object gc; | 7463 | Lisp_Object gc; |
| 7464 | int prev_face_id = it->face_id; | ||
| 7465 | int next_face_id; | ||
| 7464 | 7466 | ||
| 7465 | /* Precondition. */ | 7467 | /* Precondition. */ |
| 7466 | eassert (it->dpvec && it->current.dpvec_index >= 0); | 7468 | eassert (it->dpvec && it->current.dpvec_index >= 0); |
| @@ -7473,6 +7475,8 @@ next_element_from_display_vector (struct it *it) | |||
| 7473 | 7475 | ||
| 7474 | if (GLYPH_CODE_P (gc)) | 7476 | if (GLYPH_CODE_P (gc)) |
| 7475 | { | 7477 | { |
| 7478 | struct face *this_face, *prev_face, *next_face; | ||
| 7479 | |||
| 7476 | it->c = GLYPH_CODE_CHAR (gc); | 7480 | it->c = GLYPH_CODE_CHAR (gc); |
| 7477 | it->len = CHAR_BYTES (it->c); | 7481 | it->len = CHAR_BYTES (it->c); |
| 7478 | 7482 | ||
| @@ -7488,6 +7492,42 @@ next_element_from_display_vector (struct it *it) | |||
| 7488 | it->face_id = merge_faces (it->f, Qt, lface_id, | 7492 | it->face_id = merge_faces (it->f, Qt, lface_id, |
| 7489 | it->saved_face_id); | 7493 | it->saved_face_id); |
| 7490 | } | 7494 | } |
| 7495 | |||
| 7496 | /* Glyphs in the display vector could have the box face, so we | ||
| 7497 | need to set the related flags in the iterator, as | ||
| 7498 | appropriate. */ | ||
| 7499 | this_face = FACE_FROM_ID (it->f, it->face_id); | ||
| 7500 | prev_face = FACE_FROM_ID (it->f, prev_face_id); | ||
| 7501 | |||
| 7502 | /* Is this character the first character of a box-face run? */ | ||
| 7503 | it->start_of_box_run_p = (this_face && this_face->box != FACE_NO_BOX | ||
| 7504 | && (!prev_face | ||
| 7505 | || prev_face->box == FACE_NO_BOX)); | ||
| 7506 | |||
| 7507 | /* For the last character of the box-face run, we need to look | ||
| 7508 | either at the next glyph from the display vector, or at the | ||
| 7509 | face we saw before the display vector. */ | ||
| 7510 | if (it->current.dpvec_index < it->dpend - it->dpvec - 1) | ||
| 7511 | { | ||
| 7512 | if (it->dpvec_face_id >= 0) | ||
| 7513 | next_face_id = it->dpvec_face_id; | ||
| 7514 | else | ||
| 7515 | { | ||
| 7516 | int lface_id = | ||
| 7517 | GLYPH_CODE_FACE (it->dpvec[it->current.dpvec_index + 1]); | ||
| 7518 | |||
| 7519 | if (lface_id > 0) | ||
| 7520 | next_face_id = merge_faces (it->f, Qt, lface_id, | ||
| 7521 | it->saved_face_id); | ||
| 7522 | } | ||
| 7523 | } | ||
| 7524 | else | ||
| 7525 | next_face_id = it->saved_face_id; | ||
| 7526 | next_face = FACE_FROM_ID (it->f, next_face_id); | ||
| 7527 | it->end_of_box_run_p = (this_face && this_face->box != FACE_NO_BOX | ||
| 7528 | && (!next_face | ||
| 7529 | || next_face->box == FACE_NO_BOX)); | ||
| 7530 | it->face_box_p = this_face && this_face->box != FACE_NO_BOX; | ||
| 7491 | } | 7531 | } |
| 7492 | else | 7532 | else |
| 7493 | /* Display table entry is invalid. Return a space. */ | 7533 | /* Display table entry is invalid. Return a space. */ |