[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-24 r117336: Fix bug #17892 with mode/header line and
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-24 r117336: Fix bug #17892 with mode/header line and display margins. |
Date: |
Tue, 01 Jul 2014 17:09:19 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117336
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/17892
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Tue 2014-07-01 20:07:24 +0300
message:
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.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/dispextern.h
dispextern.h-20091113204419-o5vbwnq5f7feedwu-218
src/dispnew.c dispnew.c-20091113204419-o5vbwnq5f7feedwu-258
src/window.h window.h-20091113204419-o5vbwnq5f7feedwu-271
src/xdisp.c xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-07-01 14:51:26 +0000
+++ b/src/ChangeLog 2014-07-01 17:07:24 +0000
@@ -1,3 +1,16 @@
+2014-07-01 Eli Zaretskii <address@hidden>
+
+ * 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 <address@hidden>
* xfaces.c (init_frame_faces): Always realize basic faces (Bug#17889).
=== modified file 'src/dispextern.h'
--- a/src/dispextern.h 2014-06-21 12:34:02 +0000
+++ b/src/dispextern.h 2014-07-01 17:07:24 +0000
@@ -3473,7 +3473,7 @@
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);
=== modified file 'src/dispnew.c'
--- a/src/dispnew.c 2014-06-04 09:16:46 +0000
+++ b/src/dispnew.c 2014-07-01 17:07:24 +0000
@@ -449,7 +449,8 @@
+ 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 @@
= 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 @@
#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 @@
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;
+ }
}
=== modified file 'src/window.h'
--- a/src/window.h 2014-01-01 07:43:34 +0000
+++ b/src/window.h 2014-07-01 17:07:24 +0000
@@ -271,8 +271,10 @@
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;
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2014-06-16 19:38:28 +0000
+++ b/src/xdisp.c 2014-07-01 17:07:24 +0000
@@ -19896,7 +19896,7 @@
}
/* 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 @@
/* 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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-24 r117336: Fix bug #17892 with mode/header line and display margins.,
Eli Zaretskii <=