diff options
| author | Eli Zaretskii | 2024-08-02 09:48:55 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2024-08-02 09:48:55 +0300 |
| commit | 80108438e5e2e95ca75e59212fb1669a723241b5 (patch) | |
| tree | 37c8f14967a4c22fcb67398a000f21fd80d03cc0 /src | |
| parent | 4fa540f86587d4458cf33da352176f57e20723d4 (diff) | |
| download | emacs-80108438e5e2e95ca75e59212fb1669a723241b5.tar.gz emacs-80108438e5e2e95ca75e59212fb1669a723241b5.zip | |
Fix display of empty margins when default face is remapped
* src/xdisp.c (display_line): Append space glyphs to margin areas
if the default face is remapped and nothing is written to the
margin area of this screen line.
(produce_special_glyphs): If the truncation/continuation glyphs do
not specify a face, use the remapped default face, not the
original frame-global default face. Reported by Nicolas
P. Rougier <nicolas.rougier@inria.fr> in
https://lists.gnu.org/archive/html/emacs-devel/2024-07/msg01217.html.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index a8f9f59b654..491ce9cc970 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -25961,6 +25961,18 @@ display_line (struct it *it, int cursor_vpos) | |||
| 25961 | } | 25961 | } |
| 25962 | it->hpos = hpos_before; | 25962 | it->hpos = hpos_before; |
| 25963 | } | 25963 | } |
| 25964 | /* If the default face is remapped, and the window has | ||
| 25965 | display margins, and no glyphs were written yet to the | ||
| 25966 | margins on this screen line, we must add one space | ||
| 25967 | glyph to the margin area to make sure the margins use | ||
| 25968 | the background of the remapped default face. */ | ||
| 25969 | if (lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID) | ||
| 25970 | != DEFAULT_FACE_ID /* default face is remapped */ | ||
| 25971 | && ((WINDOW_LEFT_MARGIN_WIDTH (it->w) > 0 | ||
| 25972 | && it->glyph_row->used[LEFT_MARGIN_AREA] == 0) | ||
| 25973 | || (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0 | ||
| 25974 | && it->glyph_row->used[RIGHT_MARGIN_AREA] == 0))) | ||
| 25975 | extend_face_to_end_of_line (it); | ||
| 25964 | } | 25976 | } |
| 25965 | else if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) | 25977 | else if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) |
| 25966 | { | 25978 | { |
| @@ -32179,6 +32191,8 @@ produce_special_glyphs (struct it *it, enum display_element_type what) | |||
| 32179 | struct it temp_it; | 32191 | struct it temp_it; |
| 32180 | Lisp_Object gc; | 32192 | Lisp_Object gc; |
| 32181 | GLYPH glyph; | 32193 | GLYPH glyph; |
| 32194 | /* Take face-remapping into consideration. */ | ||
| 32195 | int face_id = lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID); | ||
| 32182 | 32196 | ||
| 32183 | temp_it = *it; | 32197 | temp_it = *it; |
| 32184 | temp_it.object = Qnil; | 32198 | temp_it.object = Qnil; |
| @@ -32188,27 +32202,27 @@ produce_special_glyphs (struct it *it, enum display_element_type what) | |||
| 32188 | { | 32202 | { |
| 32189 | /* Continuation glyph. For R2L lines, we mirror it by hand. */ | 32203 | /* Continuation glyph. For R2L lines, we mirror it by hand. */ |
| 32190 | if (it->bidi_it.paragraph_dir == R2L) | 32204 | if (it->bidi_it.paragraph_dir == R2L) |
| 32191 | SET_GLYPH_FROM_CHAR (glyph, '/'); | 32205 | SET_GLYPH (glyph, '/', face_id); |
| 32192 | else | 32206 | else |
| 32193 | SET_GLYPH_FROM_CHAR (glyph, '\\'); | 32207 | SET_GLYPH (glyph, '\\', face_id); |
| 32194 | if (it->dp | 32208 | if (it->dp |
| 32195 | && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc))) | 32209 | && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc))) |
| 32196 | { | 32210 | { |
| 32197 | /* FIXME: Should we mirror GC for R2L lines? */ | 32211 | /* FIXME: Should we mirror GC for R2L lines? */ |
| 32198 | SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); | 32212 | SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); |
| 32199 | spec_glyph_lookup_face (XWINDOW (it->window), &glyph); | 32213 | spec_glyph_lookup_face (it->w, &glyph); |
| 32200 | } | 32214 | } |
| 32201 | } | 32215 | } |
| 32202 | else if (what == IT_TRUNCATION) | 32216 | else if (what == IT_TRUNCATION) |
| 32203 | { | 32217 | { |
| 32204 | /* Truncation glyph. */ | 32218 | /* Truncation glyph. */ |
| 32205 | SET_GLYPH_FROM_CHAR (glyph, '$'); | 32219 | SET_GLYPH (glyph, '$', face_id); |
| 32206 | if (it->dp | 32220 | if (it->dp |
| 32207 | && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc))) | 32221 | && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc))) |
| 32208 | { | 32222 | { |
| 32209 | /* FIXME: Should we mirror GC for R2L lines? */ | 32223 | /* FIXME: Should we mirror GC for R2L lines? */ |
| 32210 | SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); | 32224 | SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); |
| 32211 | spec_glyph_lookup_face (XWINDOW (it->window), &glyph); | 32225 | spec_glyph_lookup_face (it->w, &glyph); |
| 32212 | } | 32226 | } |
| 32213 | } | 32227 | } |
| 32214 | else | 32228 | else |