diff options
| author | Eli Zaretskii | 2018-10-13 09:44:09 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2018-10-13 09:44:09 +0300 |
| commit | 18b42c6b4b411c217a4a2a16ccfe48640f6582e8 (patch) | |
| tree | c4a800ea3d834468857c9aadaac79dac1bb0a0d4 /src | |
| parent | a6ab8db3a3dc5ec107ef023c6659620584309c97 (diff) | |
| download | emacs-18b42c6b4b411c217a4a2a16ccfe48640f6582e8.tar.gz emacs-18b42c6b4b411c217a4a2a16ccfe48640f6582e8.zip | |
Use the 'line-number' face for line-number fields past EOB
* src/xdisp.c (get_phys_cursor_geometry): Treat rows at and
beyond ZV specially. Don't let the cursor exceed the
vertical dimensions of the row.
(maybe_produce_line_number): Use the 'line-number' face
instead of 'default' for blank fields beyond ZV. Don't update
the IT metrics when displaying blank line-number fields beyond
ZV. (Bug#32337)
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index eccefa41cf3..357f0fb30cd 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2304,7 +2304,10 @@ get_phys_cursor_geometry (struct window *w, struct glyph_row *row, | |||
| 2304 | ascent value, lest the hollow cursor looks funny. */ | 2304 | ascent value, lest the hollow cursor looks funny. */ |
| 2305 | y = w->phys_cursor.y; | 2305 | y = w->phys_cursor.y; |
| 2306 | ascent = row->ascent; | 2306 | ascent = row->ascent; |
| 2307 | if (row->ascent < glyph->ascent) | 2307 | /* The test for row at ZV is for when line numbers are displayed and |
| 2308 | point is at EOB: the cursor could then be smaller or larger than | ||
| 2309 | the default face's font. */ | ||
| 2310 | if (!row->ends_at_zv_p && row->ascent < glyph->ascent) | ||
| 2308 | { | 2311 | { |
| 2309 | y -= glyph->ascent - row->ascent; | 2312 | y -= glyph->ascent - row->ascent; |
| 2310 | ascent = glyph->ascent; | 2313 | ascent = glyph->ascent; |
| @@ -2314,6 +2317,9 @@ get_phys_cursor_geometry (struct window *w, struct glyph_row *row, | |||
| 2314 | h0 = min (FRAME_LINE_HEIGHT (f), row->visible_height); | 2317 | h0 = min (FRAME_LINE_HEIGHT (f), row->visible_height); |
| 2315 | 2318 | ||
| 2316 | h = max (h0, ascent + glyph->descent); | 2319 | h = max (h0, ascent + glyph->descent); |
| 2320 | /* Don't let the cursor exceed the dimensions of the row, so that | ||
| 2321 | the upper/lower side of the box aren't clipped. */ | ||
| 2322 | h = min (h, row->height); | ||
| 2317 | h0 = min (h0, ascent + glyph->descent); | 2323 | h0 = min (h0, ascent + glyph->descent); |
| 2318 | 2324 | ||
| 2319 | y0 = WINDOW_HEADER_LINE_HEIGHT (w); | 2325 | y0 = WINDOW_HEADER_LINE_HEIGHT (w); |
| @@ -21175,14 +21181,11 @@ maybe_produce_line_number (struct it *it) | |||
| 21175 | for (const char *p = lnum_buf; *p; p++) | 21181 | for (const char *p = lnum_buf; *p; p++) |
| 21176 | { | 21182 | { |
| 21177 | /* For continuation lines and lines after ZV, instead of a line | 21183 | /* For continuation lines and lines after ZV, instead of a line |
| 21178 | number, produce a blank prefix of the same width. Use the | 21184 | number, produce a blank prefix of the same width. */ |
| 21179 | default face for the blank field beyond ZV. */ | 21185 | if (lnum_face_id != current_lnum_face_id |
| 21180 | if (beyond_zv) | 21186 | && (EQ (Vdisplay_line_numbers, Qvisual) |
| 21181 | tem_it.face_id = it->base_face_id; | 21187 | ? this_line == 0 |
| 21182 | else if (lnum_face_id != current_lnum_face_id | 21188 | : this_line == it->pt_lnum)) |
| 21183 | && (EQ (Vdisplay_line_numbers, Qvisual) | ||
| 21184 | ? this_line == 0 | ||
| 21185 | : this_line == it->pt_lnum)) | ||
| 21186 | tem_it.face_id = current_lnum_face_id; | 21189 | tem_it.face_id = current_lnum_face_id; |
| 21187 | else | 21190 | else |
| 21188 | tem_it.face_id = lnum_face_id; | 21191 | tem_it.face_id = lnum_face_id; |
| @@ -21235,23 +21238,30 @@ maybe_produce_line_number (struct it *it) | |||
| 21235 | } | 21238 | } |
| 21236 | } | 21239 | } |
| 21237 | 21240 | ||
| 21238 | /* Update IT's metrics due to glyphs produced for line numbers. */ | 21241 | /* Update IT's metrics due to glyphs produced for line numbers. |
| 21239 | if (it->glyph_row) | 21242 | Don't do that for rows beyond ZV, to avoid displaying a cursor of |
| 21243 | different dimensions there. */ | ||
| 21244 | if (!beyond_zv) | ||
| 21240 | { | 21245 | { |
| 21241 | struct glyph_row *row = it->glyph_row; | 21246 | if (it->glyph_row) |
| 21247 | { | ||
| 21248 | struct glyph_row *row = it->glyph_row; | ||
| 21242 | 21249 | ||
| 21243 | it->max_ascent = max (row->ascent, tem_it.max_ascent); | 21250 | it->max_ascent = max (row->ascent, tem_it.max_ascent); |
| 21244 | it->max_descent = max (row->height - row->ascent, tem_it.max_descent); | 21251 | it->max_descent = max (row->height - row->ascent, tem_it.max_descent); |
| 21245 | it->max_phys_ascent = max (row->phys_ascent, tem_it.max_phys_ascent); | 21252 | it->max_phys_ascent = max (row->phys_ascent, tem_it.max_phys_ascent); |
| 21246 | it->max_phys_descent = max (row->phys_height - row->phys_ascent, | 21253 | it->max_phys_descent = max (row->phys_height - row->phys_ascent, |
| 21247 | tem_it.max_phys_descent); | 21254 | tem_it.max_phys_descent); |
| 21248 | } | 21255 | } |
| 21249 | else | 21256 | else |
| 21250 | { | 21257 | { |
| 21251 | it->max_ascent = max (it->max_ascent, tem_it.max_ascent); | 21258 | it->max_ascent = max (it->max_ascent, tem_it.max_ascent); |
| 21252 | it->max_descent = max (it->max_descent, tem_it.max_descent); | 21259 | it->max_descent = max (it->max_descent, tem_it.max_descent); |
| 21253 | it->max_phys_ascent = max (it->max_phys_ascent, tem_it.max_phys_ascent); | 21260 | it->max_phys_ascent = max (it->max_phys_ascent, |
| 21254 | it->max_phys_descent = max (it->max_phys_descent, tem_it.max_phys_descent); | 21261 | tem_it.max_phys_ascent); |
| 21262 | it->max_phys_descent = max (it->max_phys_descent, | ||
| 21263 | tem_it.max_phys_descent); | ||
| 21264 | } | ||
| 21255 | } | 21265 | } |
| 21256 | 21266 | ||
| 21257 | it->line_number_produced_p = true; | 21267 | it->line_number_produced_p = true; |