diff options
| author | Eli Zaretskii | 2014-07-01 20:07:24 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-07-01 20:07:24 +0300 |
| commit | ff6e6a42fcf9a3c7d42bd305d6a1f5c9079764ee (patch) | |
| tree | f9ceafce034b2309a680b211c82f8efbbf5ab4c3 /src | |
| parent | 3737a8efcf3a705c99a807e9c8574a89036dc3f3 (diff) | |
| download | emacs-ff6e6a42fcf9a3c7d42bd305d6a1f5c9079764ee.tar.gz emacs-ff6e6a42fcf9a3c7d42bd305d6a1f5c9079764ee.zip | |
Fix bug #17892 with mode/header line and display margins.
src/dispnew.c (prepare_desired_row): Accept 2 additional arguments:
the window whose glyph row is being prepared and a flag whether it
is for mode/header line. Make sure the glyph row's marginal areas
are in sync with what the window wants.
src/xdisp.c (display_line, display_mode_line): Call
prepare_desired_row with additional arguments, as appropriate.
src/dispextern.h (prepare_desired_row): Adjust prototype.
src/window.h: Improve commentary of the marginal columns.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/dispnew.c | 52 | ||||
| -rw-r--r-- | src/window.h | 6 | ||||
| -rw-r--r-- | src/xdisp.c | 4 |
5 files changed, 65 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4d3037d683c..f84fe133c7e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2014-07-01 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * dispnew.c (prepare_desired_row): Accept 2 additional arguments: | ||
| 4 | the window whose glyph row is being prepared and a flag whether it | ||
| 5 | is for mode/header line. Make sure the glyph row's marginal areas | ||
| 6 | are in sync with what the window wants. | ||
| 7 | (Bug#17892) | ||
| 8 | |||
| 9 | * xdisp.c (display_line, display_mode_line): Call | ||
| 10 | prepare_desired_row with additional arguments, as appropriate. | ||
| 11 | |||
| 12 | * dispextern.h (prepare_desired_row): Adjust prototype. | ||
| 13 | |||
| 1 | 2014-07-01 Dmitry Antipov <dmantipov@yandex.ru> | 14 | 2014-07-01 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 15 | ||
| 3 | * xfaces.c (init_frame_faces): Always realize basic faces (Bug#17889). | 16 | * xfaces.c (init_frame_faces): Always realize basic faces (Bug#17889). |
diff --git a/src/dispextern.h b/src/dispextern.h index 6027d5ee7ed..46ed99844e7 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3473,7 +3473,7 @@ void increment_matrix_positions (struct glyph_matrix *, | |||
| 3473 | void blank_row (struct window *, struct glyph_row *, int); | 3473 | void blank_row (struct window *, struct glyph_row *, int); |
| 3474 | void clear_glyph_matrix_rows (struct glyph_matrix *, int, int); | 3474 | void clear_glyph_matrix_rows (struct glyph_matrix *, int, int); |
| 3475 | void clear_glyph_row (struct glyph_row *); | 3475 | void clear_glyph_row (struct glyph_row *); |
| 3476 | void prepare_desired_row (struct glyph_row *); | 3476 | void prepare_desired_row (struct window *, struct glyph_row *, bool); |
| 3477 | void update_single_window (struct window *, bool); | 3477 | void update_single_window (struct window *, bool); |
| 3478 | void do_pending_window_change (bool); | 3478 | void do_pending_window_change (bool); |
| 3479 | void change_frame_size (struct frame *, int, int, bool, bool, bool, bool); | 3479 | void change_frame_size (struct frame *, int, int, bool, bool, bool, bool); |
diff --git a/src/dispnew.c b/src/dispnew.c index 163780952a6..e20d592e19e 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -449,7 +449,8 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y | |||
| 449 | + x); | 449 | + x); |
| 450 | 450 | ||
| 451 | if (w == NULL | 451 | if (w == NULL |
| 452 | || row == matrix->rows + dim.height - 1 | 452 | || (row == matrix->rows + dim.height - 1 |
| 453 | && WINDOW_WANTS_MODELINE_P (w)) | ||
| 453 | || (row == matrix->rows && matrix->header_line_p)) | 454 | || (row == matrix->rows && matrix->header_line_p)) |
| 454 | { | 455 | { |
| 455 | row->glyphs[TEXT_AREA] | 456 | row->glyphs[TEXT_AREA] |
| @@ -492,8 +493,9 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y | |||
| 492 | = xnrealloc (row->glyphs[LEFT_MARGIN_AREA], | 493 | = xnrealloc (row->glyphs[LEFT_MARGIN_AREA], |
| 493 | dim.width, sizeof (struct glyph)); | 494 | dim.width, sizeof (struct glyph)); |
| 494 | 495 | ||
| 495 | /* The mode line never has marginal areas. */ | 496 | /* The mode line, if displayed, never has marginal areas. */ |
| 496 | if (row == matrix->rows + dim.height - 1 | 497 | if ((row == matrix->rows + dim.height - 1 |
| 498 | && !(w && WINDOW_WANTS_MODELINE_P (w))) | ||
| 497 | || (row == matrix->rows && matrix->header_line_p)) | 499 | || (row == matrix->rows && matrix->header_line_p)) |
| 498 | { | 500 | { |
| 499 | row->glyphs[TEXT_AREA] | 501 | row->glyphs[TEXT_AREA] |
| @@ -1049,13 +1051,16 @@ find_glyph_row_slice (struct glyph_matrix *window_matrix, | |||
| 1049 | 1051 | ||
| 1050 | #endif /* 0 */ | 1052 | #endif /* 0 */ |
| 1051 | 1053 | ||
| 1052 | /* Prepare ROW for display. Desired rows are cleared lazily, | 1054 | /* Prepare ROW for display in windows W. Desired rows are cleared |
| 1053 | i.e. they are only marked as to be cleared by setting their | 1055 | lazily, i.e. they are only marked as to be cleared by setting their |
| 1054 | enabled_p flag to zero. When a row is to be displayed, a prior | 1056 | enabled_p flag to zero. When a row is to be displayed, a prior |
| 1055 | call to this function really clears it. */ | 1057 | call to this function really clears it. In addition, this function |
| 1058 | makes sure the marginal areas of ROW are in sync with the window's | ||
| 1059 | display margins. MODE_LINE_P non-zero means we are preparing a | ||
| 1060 | glyph row for header line or mode line. */ | ||
| 1056 | 1061 | ||
| 1057 | void | 1062 | void |
| 1058 | prepare_desired_row (struct glyph_row *row) | 1063 | prepare_desired_row (struct window *w, struct glyph_row *row, bool mode_line_p) |
| 1059 | { | 1064 | { |
| 1060 | if (!row->enabled_p) | 1065 | if (!row->enabled_p) |
| 1061 | { | 1066 | { |
| @@ -1065,6 +1070,39 @@ prepare_desired_row (struct glyph_row *row) | |||
| 1065 | row->enabled_p = true; | 1070 | row->enabled_p = true; |
| 1066 | row->reversed_p = rp; | 1071 | row->reversed_p = rp; |
| 1067 | } | 1072 | } |
| 1073 | if (mode_line_p) | ||
| 1074 | { | ||
| 1075 | /* Mode and header lines, if displayed, never have marginal | ||
| 1076 | areas. If we are called with MODE_LINE_P non-zero, we are | ||
| 1077 | displaying the mode/header line in this widnow, and so the | ||
| 1078 | marginal areas of this glyph row should be eliminated. This | ||
| 1079 | is needed when the mode/header line is switched on in a | ||
| 1080 | window that has display margins. */ | ||
| 1081 | if (w->left_margin_cols > 0) | ||
| 1082 | row->glyphs[TEXT_AREA] = row->glyphs[LEFT_MARGIN_AREA]; | ||
| 1083 | if (w->right_margin_cols > 0) | ||
| 1084 | row->glyphs[RIGHT_MARGIN_AREA] = row->glyphs[LAST_AREA]; | ||
| 1085 | } | ||
| 1086 | else if (row == MATRIX_MODE_LINE_ROW (w->desired_matrix) | ||
| 1087 | || row == MATRIX_HEADER_LINE_ROW (w->desired_matrix)) | ||
| 1088 | { | ||
| 1089 | /* The real number of glyphs reserved for the margins is | ||
| 1090 | recorded in the glyph matrix, and can be different from | ||
| 1091 | window's left_margin_cols and right_margin_cols; see | ||
| 1092 | margin_glyphs_to_reserve for when that happens. */ | ||
| 1093 | int left = w->desired_matrix->left_margin_glyphs; | ||
| 1094 | int right = w->desired_matrix->right_margin_glyphs; | ||
| 1095 | |||
| 1096 | /* Make sure the marginal areas of this row are in sync with | ||
| 1097 | what the window wants, when the 1st/last row of the matrix | ||
| 1098 | actually displays text and not header/mode line. */ | ||
| 1099 | if (w->left_margin_cols > 0 | ||
| 1100 | && (left != row->glyphs[TEXT_AREA] - row->glyphs[LEFT_MARGIN_AREA])) | ||
| 1101 | row->glyphs[TEXT_AREA] = row->glyphs[LEFT_MARGIN_AREA] + left; | ||
| 1102 | if (w->right_margin_cols > 0 | ||
| 1103 | && (right != row->glyphs[LAST_AREA] - row->glyphs[RIGHT_MARGIN_AREA])) | ||
| 1104 | row->glyphs[RIGHT_MARGIN_AREA] = row->glyphs[LAST_AREA] - right; | ||
| 1105 | } | ||
| 1068 | } | 1106 | } |
| 1069 | 1107 | ||
| 1070 | 1108 | ||
diff --git a/src/window.h b/src/window.h index bdc5dddb7e5..b9c2b1f5ba8 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -271,8 +271,10 @@ struct window | |||
| 271 | int left_fringe_width; | 271 | int left_fringe_width; |
| 272 | int right_fringe_width; | 272 | int right_fringe_width; |
| 273 | 273 | ||
| 274 | /* Width of left and right marginal areas in columns. | 274 | /* Requested width of left and right marginal areas in columns. A |
| 275 | A value of 0 means no margin. */ | 275 | value of 0 means no margin. The actual values are recorded in |
| 276 | the window's glyph matrix, in the left_margin_glyphs and | ||
| 277 | right_margin_glyphs members. */ | ||
| 276 | int left_margin_cols; | 278 | int left_margin_cols; |
| 277 | int right_margin_cols; | 279 | int right_margin_cols; |
| 278 | 280 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 1106e6fe25f..459edf4367f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -19896,7 +19896,7 @@ display_line (struct it *it) | |||
| 19896 | } | 19896 | } |
| 19897 | 19897 | ||
| 19898 | /* Clear the result glyph row and enable it. */ | 19898 | /* Clear the result glyph row and enable it. */ |
| 19899 | prepare_desired_row (row); | 19899 | prepare_desired_row (it->w, row, false); |
| 19900 | 19900 | ||
| 19901 | row->y = it->current_y; | 19901 | row->y = it->current_y; |
| 19902 | row->start = it->start; | 19902 | row->start = it->start; |
| @@ -21535,7 +21535,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format) | |||
| 21535 | /* Don't extend on a previously drawn mode-line. | 21535 | /* Don't extend on a previously drawn mode-line. |
| 21536 | This may happen if called from pos_visible_p. */ | 21536 | This may happen if called from pos_visible_p. */ |
| 21537 | it.glyph_row->enabled_p = false; | 21537 | it.glyph_row->enabled_p = false; |
| 21538 | prepare_desired_row (it.glyph_row); | 21538 | prepare_desired_row (w, it.glyph_row, true); |
| 21539 | 21539 | ||
| 21540 | it.glyph_row->mode_line_p = 1; | 21540 | it.glyph_row->mode_line_p = 1; |
| 21541 | 21541 | ||