diff options
author | Eli Zaretskii <eliz@gnu.org> | 2013-12-23 18:36:34 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2013-12-23 18:36:34 +0200 |
commit | 0db7548bea067f74998d8219d524220d8ff1269b (patch) | |
tree | b503a5b286574bde4ac25845c33f1d760a6f512d /src/xdisp.c | |
parent | 4157ea7faf2815b8903a981f6375af529c7047ae (diff) |
Fix most of bug #16051 with redisplay loops when resizing tool-bar.
src/xdisp.c (tool_bar_height): Use WINDOW_PIXEL_WIDTH to set up the
iterator X limits, not FRAME_TOTAL_COLS, for consistency with what
redisplay_tool_bar does. Improve and fix commentary.
(hscroll_window_tree): Don't assume w->cursor.vpos is within the
limits of the glyph matrices.
Diffstat (limited to 'src/xdisp.c')
-rw-r--r-- | src/xdisp.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index b0fcedbd80..9a3c27fc6a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12057,8 +12057,8 @@ display_tool_bar_line (struct it *it, int height) #define MAX_FRAME_TOOL_BAR_HEIGHT(f) \ ((FRAME_LINE_HEIGHT (f) * FRAME_LINES (f))) -/* Value is the number of screen lines needed to make all tool-bar - items of frame F visible. The number of actual rows needed is +/* Value is the number of pixels needed to make all tool-bar items of + frame F visible. The actual number of glyph rows needed is returned in *N_ROWS if non-NULL. */ static int @@ -12075,8 +12075,7 @@ tool_bar_height (struct frame *f, int *n_rows, bool pixelwise) F->desired_tool_bar_string in the tool-bar window of frame F. */ init_iterator (&it, w, -1, -1, temp_row, TOOL_BAR_FACE_ID); it.first_visible_x = 0; - /* PXW: Use FRAME_PIXEL_WIDTH (f) here? */ - it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); + it.last_visible_x = WINDOW_PIXEL_WIDTH (w); reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); it.paragraph_embedding = L2R; @@ -12254,6 +12253,10 @@ redisplay_tool_bar (struct frame *f) && it.current_y < max_tool_bar_height) change_height_p = 1; + /* We subtract 1 because display_tool_bar_line advances the + glyph_row pointer before returning to its caller. We want to + examine the last glyph row produced by + display_tool_bar_line. */ row = it.glyph_row - 1; /* If there are blank lines at the end, except for a partially @@ -12607,15 +12610,25 @@ hscroll_window_tree (Lisp_Object window) { int h_margin; int text_area_width; - struct glyph_row *current_cursor_row - = MATRIX_ROW (w->current_matrix, w->cursor.vpos); - struct glyph_row *desired_cursor_row - = MATRIX_ROW (w->desired_matrix, w->cursor.vpos); - struct glyph_row *cursor_row - = (desired_cursor_row->enabled_p - ? desired_cursor_row - : current_cursor_row); - int row_r2l_p = cursor_row->reversed_p; + struct glyph_row *cursor_row; + struct glyph_row *bottom_row; + int row_r2l_p; + + bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->desired_matrix, w); + if (w->cursor.vpos < bottom_row - w->desired_matrix->rows) + cursor_row = MATRIX_ROW (w->desired_matrix, w->cursor.vpos); + else + cursor_row = bottom_row - 1; + + if (!cursor_row->enabled_p) + { + bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); + if (w->cursor.vpos < bottom_row - w->current_matrix->rows) + cursor_row = MATRIX_ROW (w->current_matrix, w->cursor.vpos); + else + cursor_row = bottom_row - 1; + } + row_r2l_p = cursor_row->reversed_p; text_area_width = window_box_width (w, TEXT_AREA); |