diff --git a/src/xdisp.c b/src/xdisp.c index 7338d2b7d4..a39f2e0bd9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -21837,17 +21837,17 @@ display_line (struct it *it, int cursor_vpos) buffer reached. */ if (!get_next_display_element (it)) { - bool row_has_glyphs = false; + const bool row_has_glyphs = row_text_area_empty (row); /* Maybe add a space at the end of this line that is used to display the cursor there under X. Set the charpos of the first glyph of blank lines not corresponding to any text to -1. */ if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) row->exact_window_width_line_p = true; - else if ((append_space_for_newline (it, true) + else if (row_has_glyphs + ||(append_space_for_newline (it, true) && row->used[TEXT_AREA] == 1) - || row->used[TEXT_AREA] == 0 - || (row_has_glyphs = row_text_area_empty (row))) + || row->used[TEXT_AREA] == 0) { row->glyphs[TEXT_AREA]->charpos = -1; /* Don't reset the displays_text_p flag if we are @@ -21878,7 +21878,8 @@ display_line (struct it *it, int cursor_vpos) background color. */ if (row->reversed_p || lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID) - != DEFAULT_FACE_ID) + != DEFAULT_FACE_ID + || !row_has_glyphs) extend_face_to_end_of_line (it); break; }