Commit ff6e6a42 authored by Eli Zaretskii's avatar Eli Zaretskii

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.
parent 3737a8ef
2014-07-01 Eli Zaretskii <eliz@gnu.org>
* 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.
(Bug#17892)
* xdisp.c (display_line, display_mode_line): Call
prepare_desired_row with additional arguments, as appropriate.
* dispextern.h (prepare_desired_row): Adjust prototype.
2014-07-01 Dmitry Antipov <dmantipov@yandex.ru>
* xfaces.c (init_frame_faces): Always realize basic faces (Bug#17889).
......
......@@ -3473,7 +3473,7 @@ void increment_matrix_positions (struct glyph_matrix *,
void blank_row (struct window *, struct glyph_row *, int);
void clear_glyph_matrix_rows (struct glyph_matrix *, int, int);
void clear_glyph_row (struct glyph_row *);
void prepare_desired_row (struct glyph_row *);
void prepare_desired_row (struct window *, struct glyph_row *, bool);
void update_single_window (struct window *, bool);
void do_pending_window_change (bool);
void change_frame_size (struct frame *, int, int, bool, bool, bool, bool);
......
......@@ -449,7 +449,8 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
+ x);
if (w == NULL
|| row == matrix->rows + dim.height - 1
|| (row == matrix->rows + dim.height - 1
&& WINDOW_WANTS_MODELINE_P (w))
|| (row == matrix->rows && matrix->header_line_p))
{
row->glyphs[TEXT_AREA]
......@@ -492,8 +493,9 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
= xnrealloc (row->glyphs[LEFT_MARGIN_AREA],
dim.width, sizeof (struct glyph));
/* The mode line never has marginal areas. */
if (row == matrix->rows + dim.height - 1
/* The mode line, if displayed, never has marginal areas. */
if ((row == matrix->rows + dim.height - 1
&& !(w && WINDOW_WANTS_MODELINE_P (w)))
|| (row == matrix->rows && matrix->header_line_p))
{
row->glyphs[TEXT_AREA]
......@@ -1049,13 +1051,16 @@ find_glyph_row_slice (struct glyph_matrix *window_matrix,
#endif /* 0 */
/* Prepare ROW for display. Desired rows are cleared lazily,
i.e. they are only marked as to be cleared by setting their
/* Prepare ROW for display in windows W. Desired rows are cleared
lazily, i.e. they are only marked as to be cleared by setting their
enabled_p flag to zero. When a row is to be displayed, a prior
call to this function really clears it. */
call to this function really clears it. In addition, this function
makes sure the marginal areas of ROW are in sync with the window's
display margins. MODE_LINE_P non-zero means we are preparing a
glyph row for header line or mode line. */
void
prepare_desired_row (struct glyph_row *row)
prepare_desired_row (struct window *w, struct glyph_row *row, bool mode_line_p)
{
if (!row->enabled_p)
{
......@@ -1065,6 +1070,39 @@ prepare_desired_row (struct glyph_row *row)
row->enabled_p = true;
row->reversed_p = rp;
}
if (mode_line_p)
{
/* Mode and header lines, if displayed, never have marginal
areas. If we are called with MODE_LINE_P non-zero, we are
displaying the mode/header line in this widnow, and so the
marginal areas of this glyph row should be eliminated. This
is needed when the mode/header line is switched on in a
window that has display margins. */
if (w->left_margin_cols > 0)
row->glyphs[TEXT_AREA] = row->glyphs[LEFT_MARGIN_AREA];
if (w->right_margin_cols > 0)
row->glyphs[RIGHT_MARGIN_AREA] = row->glyphs[LAST_AREA];
}
else if (row == MATRIX_MODE_LINE_ROW (w->desired_matrix)
|| row == MATRIX_HEADER_LINE_ROW (w->desired_matrix))
{
/* The real number of glyphs reserved for the margins is
recorded in the glyph matrix, and can be different from
window's left_margin_cols and right_margin_cols; see
margin_glyphs_to_reserve for when that happens. */
int left = w->desired_matrix->left_margin_glyphs;
int right = w->desired_matrix->right_margin_glyphs;
/* Make sure the marginal areas of this row are in sync with
what the window wants, when the 1st/last row of the matrix
actually displays text and not header/mode line. */
if (w->left_margin_cols > 0
&& (left != row->glyphs[TEXT_AREA] - row->glyphs[LEFT_MARGIN_AREA]))
row->glyphs[TEXT_AREA] = row->glyphs[LEFT_MARGIN_AREA] + left;
if (w->right_margin_cols > 0
&& (right != row->glyphs[LAST_AREA] - row->glyphs[RIGHT_MARGIN_AREA]))
row->glyphs[RIGHT_MARGIN_AREA] = row->glyphs[LAST_AREA] - right;
}
}
......
......@@ -271,8 +271,10 @@ struct window
int left_fringe_width;
int right_fringe_width;
/* Width of left and right marginal areas in columns.
A value of 0 means no margin. */
/* Requested width of left and right marginal areas in columns. A
value of 0 means no margin. The actual values are recorded in
the window's glyph matrix, in the left_margin_glyphs and
right_margin_glyphs members. */
int left_margin_cols;
int right_margin_cols;
......
......@@ -19896,7 +19896,7 @@ display_line (struct it *it)
}
/* Clear the result glyph row and enable it. */
prepare_desired_row (row);
prepare_desired_row (it->w, row, false);
row->y = it->current_y;
row->start = it->start;
......@@ -21535,7 +21535,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
/* Don't extend on a previously drawn mode-line.
This may happen if called from pos_visible_p. */
it.glyph_row->enabled_p = false;
prepare_desired_row (it.glyph_row);
prepare_desired_row (w, it.glyph_row, true);
it.glyph_row->mode_line_p = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment