diff options
author | Eli Zaretskii <eliz@gnu.org> | 2018-10-13 09:44:09 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2018-10-13 09:44:09 +0300 |
commit | 18b42c6b4b411c217a4a2a16ccfe48640f6582e8 (patch) | |
tree | c4a800ea3d834468857c9aadaac79dac1bb0a0d4 /src/xdisp.c | |
parent | a6ab8db3a3dc5ec107ef023c6659620584309c97 (diff) | |
download | emacs-18b42c6b4b411c217a4a2a16ccfe48640f6582e8.tar.gz |
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/xdisp.c')
-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, ascent value, lest the hollow cursor looks funny. */ y = w->phys_cursor.y; ascent = row->ascent; - if (row->ascent < glyph->ascent) + /* The test for row at ZV is for when line numbers are displayed and + point is at EOB: the cursor could then be smaller or larger than + the default face's font. */ + if (!row->ends_at_zv_p && row->ascent < glyph->ascent) { y -= glyph->ascent - row->ascent; ascent = glyph->ascent; @@ -2314,6 +2317,9 @@ get_phys_cursor_geometry (struct window *w, struct glyph_row *row, h0 = min (FRAME_LINE_HEIGHT (f), row->visible_height); h = max (h0, ascent + glyph->descent); + /* Don't let the cursor exceed the dimensions of the row, so that + the upper/lower side of the box aren't clipped. */ + h = min (h, row->height); h0 = min (h0, ascent + glyph->descent); y0 = WINDOW_HEADER_LINE_HEIGHT (w); @@ -21175,14 +21181,11 @@ maybe_produce_line_number (struct it *it) for (const char *p = lnum_buf; *p; p++) { /* For continuation lines and lines after ZV, instead of a line - number, produce a blank prefix of the same width. Use the - default face for the blank field beyond ZV. */ - if (beyond_zv) - tem_it.face_id = it->base_face_id; - else if (lnum_face_id != current_lnum_face_id - && (EQ (Vdisplay_line_numbers, Qvisual) - ? this_line == 0 - : this_line == it->pt_lnum)) + number, produce a blank prefix of the same width. */ + if (lnum_face_id != current_lnum_face_id + && (EQ (Vdisplay_line_numbers, Qvisual) + ? this_line == 0 + : this_line == it->pt_lnum)) tem_it.face_id = current_lnum_face_id; else tem_it.face_id = lnum_face_id; @@ -21235,23 +21238,30 @@ maybe_produce_line_number (struct it *it) } } - /* Update IT's metrics due to glyphs produced for line numbers. */ - if (it->glyph_row) + /* Update IT's metrics due to glyphs produced for line numbers. + Don't do that for rows beyond ZV, to avoid displaying a cursor of + different dimensions there. */ + if (!beyond_zv) { - struct glyph_row *row = it->glyph_row; + if (it->glyph_row) + { + struct glyph_row *row = it->glyph_row; - it->max_ascent = max (row->ascent, tem_it.max_ascent); - it->max_descent = max (row->height - row->ascent, tem_it.max_descent); - it->max_phys_ascent = max (row->phys_ascent, tem_it.max_phys_ascent); - it->max_phys_descent = max (row->phys_height - row->phys_ascent, - tem_it.max_phys_descent); - } - else - { - it->max_ascent = max (it->max_ascent, tem_it.max_ascent); - it->max_descent = max (it->max_descent, tem_it.max_descent); - it->max_phys_ascent = max (it->max_phys_ascent, tem_it.max_phys_ascent); - it->max_phys_descent = max (it->max_phys_descent, tem_it.max_phys_descent); + it->max_ascent = max (row->ascent, tem_it.max_ascent); + it->max_descent = max (row->height - row->ascent, tem_it.max_descent); + it->max_phys_ascent = max (row->phys_ascent, tem_it.max_phys_ascent); + it->max_phys_descent = max (row->phys_height - row->phys_ascent, + tem_it.max_phys_descent); + } + else + { + it->max_ascent = max (it->max_ascent, tem_it.max_ascent); + it->max_descent = max (it->max_descent, tem_it.max_descent); + it->max_phys_ascent = max (it->max_phys_ascent, + tem_it.max_phys_ascent); + it->max_phys_descent = max (it->max_phys_descent, + tem_it.max_phys_descent); + } } it->line_number_produced_p = true; |