Fix redisplay when mode-line-format changes mode-line's height
* lisp/frame.el (top-level): Add mode-line-format, tab-line-format, and header-line-format to the list of variables that should trigger an immediate redisplay of the buffer's window. This fixes redisplay of windows when the mode line changes its height. * src/xdisp.c (window_box_height): Use the window's mode_line_height, tab_line_height, and header_line_height fields in preference to CURRENT_MODE_LINE_HEIGHT, CURRENT_TAB_LINE_HEIGHT, and CURRENT_HEADER_LINE_HEIGHT, respectively. This fixes display of vertical scroll bar when the height of the window's mode line changes. * src/dispnew.c (adjust_glyph_matrix): When resizing a window's matrix, reset the mode_line_p flag of the previous mode-line row, so that the window_box_height, CURRENT_MODE_LINE_HEIGHT, and their ilk won't use stale info. (Bug#38828)
This commit is contained in:
parent
1420906b81
commit
37f9182b68
3 changed files with 50 additions and 25 deletions
|
@ -2725,6 +2725,9 @@ See also `toggle-frame-maximized'."
|
||||||
line-prefix
|
line-prefix
|
||||||
wrap-prefix
|
wrap-prefix
|
||||||
truncate-lines
|
truncate-lines
|
||||||
|
mode-line-format
|
||||||
|
header-line-format
|
||||||
|
tab-line-format
|
||||||
display-line-numbers
|
display-line-numbers
|
||||||
display-line-numbers-width
|
display-line-numbers-width
|
||||||
display-line-numbers-current-absolute
|
display-line-numbers-current-absolute
|
||||||
|
|
|
@ -534,6 +534,13 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
|
||||||
eassert (left >= 0 && right >= 0);
|
eassert (left >= 0 && right >= 0);
|
||||||
matrix->left_margin_glyphs = left;
|
matrix->left_margin_glyphs = left;
|
||||||
matrix->right_margin_glyphs = right;
|
matrix->right_margin_glyphs = right;
|
||||||
|
|
||||||
|
/* If we are resizing a window, make sure the previous mode-line
|
||||||
|
row of the window's current matrix is no longer marked as such. */
|
||||||
|
if (w && matrix == w->current_matrix
|
||||||
|
&& dim.height != matrix->nrows
|
||||||
|
&& matrix->nrows <= matrix->rows_allocated)
|
||||||
|
MATRIX_MODE_LINE_ROW (matrix)->mode_line_p = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Number of rows to be used by MATRIX. */
|
/* Number of rows to be used by MATRIX. */
|
||||||
|
|
65
src/xdisp.c
65
src/xdisp.c
|
@ -1093,44 +1093,59 @@ window_box_height (struct window *w)
|
||||||
|
|
||||||
/* Note: the code below that determines the mode-line/header-line/tab-line
|
/* Note: the code below that determines the mode-line/header-line/tab-line
|
||||||
height is essentially the same as that contained in the macro
|
height is essentially the same as that contained in the macro
|
||||||
CURRENT_{MODE,HEADER}_LINE_HEIGHT, except that it checks whether
|
CURRENT_{MODE,HEADER,TAB}_LINE_HEIGHT, except that it checks whether
|
||||||
the appropriate glyph row has its `mode_line_p' flag set,
|
the appropriate glyph row has its `mode_line_p' flag set, and if
|
||||||
and if it doesn't, uses estimate_mode_line_height instead. */
|
it doesn't, uses estimate_mode_line_height instead. */
|
||||||
|
|
||||||
if (window_wants_mode_line (w))
|
if (window_wants_mode_line (w))
|
||||||
{
|
{
|
||||||
struct glyph_row *ml_row
|
if (w->mode_line_height >= 0)
|
||||||
= (w->current_matrix && w->current_matrix->rows
|
height -= w->mode_line_height;
|
||||||
? MATRIX_MODE_LINE_ROW (w->current_matrix)
|
|
||||||
: 0);
|
|
||||||
if (ml_row && ml_row->mode_line_p)
|
|
||||||
height -= ml_row->height;
|
|
||||||
else
|
else
|
||||||
height -= estimate_mode_line_height (f, CURRENT_MODE_LINE_FACE_ID (w));
|
{
|
||||||
|
struct glyph_row *ml_row
|
||||||
|
= (w->current_matrix && w->current_matrix->rows
|
||||||
|
? MATRIX_MODE_LINE_ROW (w->current_matrix)
|
||||||
|
: 0);
|
||||||
|
if (ml_row && ml_row->mode_line_p)
|
||||||
|
height -= ml_row->height;
|
||||||
|
else
|
||||||
|
height -= estimate_mode_line_height (f,
|
||||||
|
CURRENT_MODE_LINE_FACE_ID (w));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window_wants_tab_line (w))
|
if (window_wants_tab_line (w))
|
||||||
{
|
{
|
||||||
struct glyph_row *tl_row
|
if (w->tab_line_height >= 0)
|
||||||
= (w->current_matrix && w->current_matrix->rows
|
height -= w->tab_line_height;
|
||||||
? MATRIX_TAB_LINE_ROW (w->current_matrix)
|
|
||||||
: 0);
|
|
||||||
if (tl_row && tl_row->mode_line_p)
|
|
||||||
height -= tl_row->height;
|
|
||||||
else
|
else
|
||||||
height -= estimate_mode_line_height (f, TAB_LINE_FACE_ID);
|
{
|
||||||
|
struct glyph_row *tl_row
|
||||||
|
= (w->current_matrix && w->current_matrix->rows
|
||||||
|
? MATRIX_TAB_LINE_ROW (w->current_matrix)
|
||||||
|
: 0);
|
||||||
|
if (tl_row && tl_row->mode_line_p)
|
||||||
|
height -= tl_row->height;
|
||||||
|
else
|
||||||
|
height -= estimate_mode_line_height (f, TAB_LINE_FACE_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window_wants_header_line (w))
|
if (window_wants_header_line (w))
|
||||||
{
|
{
|
||||||
struct glyph_row *hl_row
|
if (w->header_line_height >= 0)
|
||||||
= (w->current_matrix && w->current_matrix->rows
|
height -= w->header_line_height;
|
||||||
? MATRIX_HEADER_LINE_ROW (w->current_matrix)
|
{
|
||||||
: 0);
|
struct glyph_row *hl_row
|
||||||
if (hl_row && hl_row->mode_line_p)
|
= (w->current_matrix && w->current_matrix->rows
|
||||||
height -= hl_row->height;
|
? MATRIX_HEADER_LINE_ROW (w->current_matrix)
|
||||||
else
|
: 0);
|
||||||
height -= estimate_mode_line_height (f, HEADER_LINE_FACE_ID);
|
if (hl_row && hl_row->mode_line_p)
|
||||||
|
height -= hl_row->height;
|
||||||
|
else
|
||||||
|
height -= estimate_mode_line_height (f, HEADER_LINE_FACE_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* With a very small font and a mode-line that's taller than
|
/* With a very small font and a mode-line that's taller than
|
||||||
|
|
Loading…
Add table
Reference in a new issue