aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2020-01-06 21:49:24 +0200
committerEli Zaretskii2020-01-06 21:49:24 +0200
commit16c6dfb4f16bd399c70eade799ee5621614f7e83 (patch)
tree997a3ed8520d04d76e0f698bee170e0543b9c2fd /src
parent9063124b9125ed5e2ad87bbb8bd6224526723a92 (diff)
downloademacs-16c6dfb4f16bd399c70eade799ee5621614f7e83.tar.gz
emacs-16c6dfb4f16bd399c70eade799ee5621614f7e83.zip
Avoid assertion violations in very small-height windows
* src/xdisp.c (try_cursor_movement, redisplay_window) (row_containing_pos): Skip tab-line glyph rows in addition to header-line rows, when working on the top-most glyph row of a window. This avoids assertion violations in set_cursor_from_row. (Bug#38966)
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 3d286cb22fb..f3a297a7020 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -16244,8 +16244,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
16244 bool string_from_text_prop = false; 16244 bool string_from_text_prop = false;
16245 16245
16246 /* Don't even try doing anything if called for a mode-line or 16246 /* Don't even try doing anything if called for a mode-line or
16247 header-line row, since the rest of the code isn't prepared to 16247 header-line or tab-line row, since the rest of the code isn't
16248 deal with such calamities. */ 16248 prepared to deal with such calamities. */
16249 eassert (!row->mode_line_p); 16249 eassert (!row->mode_line_p);
16250 if (row->mode_line_p) 16250 if (row->mode_line_p)
16251 return false; 16251 return false;
@@ -17504,6 +17504,9 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp,
17504 else 17504 else
17505 { 17505 {
17506 row = MATRIX_ROW (w->current_matrix, w->last_cursor_vpos); 17506 row = MATRIX_ROW (w->current_matrix, w->last_cursor_vpos);
17507 /* Skip the tab-line and header-line rows, if any. */
17508 if (row->tab_line_p)
17509 ++row;
17507 if (row->mode_line_p) 17510 if (row->mode_line_p)
17508 ++row; 17511 ++row;
17509 if (!row->enabled_p) 17512 if (!row->enabled_p)
@@ -17576,6 +17579,9 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp,
17576 || row->mode_line_p) 17579 || row->mode_line_p)
17577 { 17580 {
17578 row = w->current_matrix->rows; 17581 row = w->current_matrix->rows;
17582 /* Skip the tab-line and header-line rows, if any. */
17583 if (row->tab_line_p)
17584 ++row;
17579 if (row->mode_line_p) 17585 if (row->mode_line_p)
17580 ++row; 17586 ++row;
17581 } 17587 }
@@ -17640,8 +17646,9 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp,
17640 ; 17646 ;
17641 else if (rc != CURSOR_MOVEMENT_SUCCESS 17647 else if (rc != CURSOR_MOVEMENT_SUCCESS
17642 && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row) 17648 && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
17643 /* Make sure this isn't a header line by any chance, since 17649 /* Make sure this isn't a header line nor a tab-line by
17644 then MATRIX_ROW_PARTIALLY_VISIBLE_P might yield true. */ 17650 any chance, since then MATRIX_ROW_PARTIALLY_VISIBLE_P
17651 might yield true. */
17645 && !row->mode_line_p 17652 && !row->mode_line_p
17646 && !cursor_row_fully_visible_p (w, true, true, true)) 17653 && !cursor_row_fully_visible_p (w, true, true, true))
17647 { 17654 {
@@ -18769,11 +18776,14 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
18769 } 18776 }
18770 } 18777 }
18771 /* Finally, fall back on the first row of the window after the 18778 /* Finally, fall back on the first row of the window after the
18772 header line (if any). This is slightly better than not 18779 tab-line and header line (if any). This is slightly better
18773 displaying the cursor at all. */ 18780 than not displaying the cursor at all. */
18774 if (!row) 18781 if (!row)
18775 { 18782 {
18776 row = matrix->rows; 18783 row = matrix->rows;
18784 /* Skip the tab-line and header-line rows, if any. */
18785 if (row->tab_line_p)
18786 ++row;
18777 if (row->mode_line_p) 18787 if (row->mode_line_p)
18778 ++row; 18788 ++row;
18779 } 18789 }
@@ -19787,7 +19797,9 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
19787 ptrdiff_t mindif = BUF_ZV (XBUFFER (w->contents)) + 1; 19797 ptrdiff_t mindif = BUF_ZV (XBUFFER (w->contents)) + 1;
19788 int last_y; 19798 int last_y;
19789 19799
19790 /* If we happen to start on a header-line, skip that. */ 19800 /* If we happen to start on a header-line or a tab-line, skip that. */
19801 if (row->tab_line_p)
19802 ++row;
19791 if (row->mode_line_p) 19803 if (row->mode_line_p)
19792 ++row; 19804 ++row;
19793 19805
@@ -22380,7 +22392,7 @@ find_row_edges (struct it *it, struct glyph_row *row,
22380 if (STRINGP (it->object) 22392 if (STRINGP (it->object)
22381 /* this is not the first row */ 22393 /* this is not the first row */
22382 && row > it->w->desired_matrix->rows 22394 && row > it->w->desired_matrix->rows
22383 /* previous row is not the header line */ 22395 /* previous row is not the header line or tab-line */
22384 && !r1->mode_line_p 22396 && !r1->mode_line_p
22385 /* previous row also ends in a newline from a string */ 22397 /* previous row also ends in a newline from a string */
22386 && r1->ends_in_newline_from_string_p) 22398 && r1->ends_in_newline_from_string_p)