aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2020-01-03 09:28:35 +0200
committerEli Zaretskii2020-01-03 09:28:35 +0200
commit37f9182b68c62ee1912cf28d4ea0c30b4f8d59e0 (patch)
tree34e6b10b93ae5cee0e68ab7bc95acec454621fcb /src
parent1420906b812852fab3ee37393db813afdf9e75b7 (diff)
downloademacs-37f9182b68c62ee1912cf28d4ea0c30b4f8d59e0.tar.gz
emacs-37f9182b68c62ee1912cf28d4ea0c30b4f8d59e0.zip
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)
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c7
-rw-r--r--src/xdisp.c65
2 files changed, 47 insertions, 25 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index b2a257090cc..ed8c5552e75 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -534,6 +534,13 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
534 eassert (left >= 0 && right >= 0); 534 eassert (left >= 0 && right >= 0);
535 matrix->left_margin_glyphs = left; 535 matrix->left_margin_glyphs = left;
536 matrix->right_margin_glyphs = right; 536 matrix->right_margin_glyphs = right;
537
538 /* If we are resizing a window, make sure the previous mode-line
539 row of the window's current matrix is no longer marked as such. */
540 if (w && matrix == w->current_matrix
541 && dim.height != matrix->nrows
542 && matrix->nrows <= matrix->rows_allocated)
543 MATRIX_MODE_LINE_ROW (matrix)->mode_line_p = false;
537 } 544 }
538 545
539 /* Number of rows to be used by MATRIX. */ 546 /* Number of rows to be used by MATRIX. */
diff --git a/src/xdisp.c b/src/xdisp.c
index 6b677b63ae4..4856a7b13b6 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1093,44 +1093,59 @@ window_box_height (struct window *w)
1093 1093
1094 /* Note: the code below that determines the mode-line/header-line/tab-line 1094 /* Note: the code below that determines the mode-line/header-line/tab-line
1095 height is essentially the same as that contained in the macro 1095 height is essentially the same as that contained in the macro
1096 CURRENT_{MODE,HEADER}_LINE_HEIGHT, except that it checks whether 1096 CURRENT_{MODE,HEADER,TAB}_LINE_HEIGHT, except that it checks whether
1097 the appropriate glyph row has its `mode_line_p' flag set, 1097 the appropriate glyph row has its `mode_line_p' flag set, and if
1098 and if it doesn't, uses estimate_mode_line_height instead. */ 1098 it doesn't, uses estimate_mode_line_height instead. */
1099 1099
1100 if (window_wants_mode_line (w)) 1100 if (window_wants_mode_line (w))
1101 { 1101 {
1102 struct glyph_row *ml_row 1102 if (w->mode_line_height >= 0)
1103 = (w->current_matrix && w->current_matrix->rows 1103 height -= w->mode_line_height;
1104 ? MATRIX_MODE_LINE_ROW (w->current_matrix)
1105 : 0);
1106 if (ml_row && ml_row->mode_line_p)
1107 height -= ml_row->height;
1108 else 1104 else
1109 height -= estimate_mode_line_height (f, CURRENT_MODE_LINE_FACE_ID (w)); 1105 {
1106 struct glyph_row *ml_row
1107 = (w->current_matrix && w->current_matrix->rows
1108 ? MATRIX_MODE_LINE_ROW (w->current_matrix)
1109 : 0);
1110 if (ml_row && ml_row->mode_line_p)
1111 height -= ml_row->height;
1112 else
1113 height -= estimate_mode_line_height (f,
1114 CURRENT_MODE_LINE_FACE_ID (w));
1115 }
1110 } 1116 }
1111 1117
1112 if (window_wants_tab_line (w)) 1118 if (window_wants_tab_line (w))
1113 { 1119 {
1114 struct glyph_row *tl_row 1120 if (w->tab_line_height >= 0)
1115 = (w->current_matrix && w->current_matrix->rows 1121 height -= w->tab_line_height;
1116 ? MATRIX_TAB_LINE_ROW (w->current_matrix)
1117 : 0);
1118 if (tl_row && tl_row->mode_line_p)
1119 height -= tl_row->height;
1120 else 1122 else
1121 height -= estimate_mode_line_height (f, TAB_LINE_FACE_ID); 1123 {
1124 struct glyph_row *tl_row
1125 = (w->current_matrix && w->current_matrix->rows
1126 ? MATRIX_TAB_LINE_ROW (w->current_matrix)
1127 : 0);
1128 if (tl_row && tl_row->mode_line_p)
1129 height -= tl_row->height;
1130 else
1131 height -= estimate_mode_line_height (f, TAB_LINE_FACE_ID);
1132 }
1122 } 1133 }
1123 1134
1124 if (window_wants_header_line (w)) 1135 if (window_wants_header_line (w))
1125 { 1136 {
1126 struct glyph_row *hl_row 1137 if (w->header_line_height >= 0)
1127 = (w->current_matrix && w->current_matrix->rows 1138 height -= w->header_line_height;
1128 ? MATRIX_HEADER_LINE_ROW (w->current_matrix) 1139 {
1129 : 0); 1140 struct glyph_row *hl_row
1130 if (hl_row && hl_row->mode_line_p) 1141 = (w->current_matrix && w->current_matrix->rows
1131 height -= hl_row->height; 1142 ? MATRIX_HEADER_LINE_ROW (w->current_matrix)
1132 else 1143 : 0);
1133 height -= estimate_mode_line_height (f, HEADER_LINE_FACE_ID); 1144 if (hl_row && hl_row->mode_line_p)
1145 height -= hl_row->height;
1146 else
1147 height -= estimate_mode_line_height (f, HEADER_LINE_FACE_ID);
1148 }
1134 } 1149 }
1135 1150
1136 /* With a very small font and a mode-line that's taller than 1151 /* With a very small font and a mode-line that's taller than