[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/xdisp.c
From: |
Kim F . Storm |
Subject: |
[Emacs-diffs] Changes to emacs/src/xdisp.c |
Date: |
Tue, 15 Jun 2004 09:55:25 -0400 |
Index: emacs/src/xdisp.c
diff -c emacs/src/xdisp.c:1.893 emacs/src/xdisp.c:1.894
*** emacs/src/xdisp.c:1.893 Mon Jun 14 20:49:05 2004
--- emacs/src/xdisp.c Tue Jun 15 10:35:05 2004
***************
*** 11267,11273 ****
&& (FRAME_WINDOW_P (f)
|| !overlay_arrow_in_current_buffer_p ()))
{
! int this_scroll_margin;
struct glyph_row *row = NULL;
#if GLYPH_DEBUG
--- 11267,11273 ----
&& (FRAME_WINDOW_P (f)
|| !overlay_arrow_in_current_buffer_p ()))
{
! int this_scroll_margin, top_scroll_margin;
struct glyph_row *row = NULL;
#if GLYPH_DEBUG
***************
*** 11280,11285 ****
--- 11280,11289 ----
this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) /
4);
this_scroll_margin *= FRAME_LINE_HEIGHT (f);
+ top_scroll_margin = this_scroll_margin;
+ if (WINDOW_WANTS_HEADER_LINE_P (w))
+ top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w);
+
/* Start with the row the cursor was displayed during the last
not paused redisplay. Give up if that row is not valid. */
if (w->last_cursor.vpos < 0
***************
*** 11340,11346 ****
&& (MATRIX_ROW_START_CHARPOS (row) > PT
|| (MATRIX_ROW_START_CHARPOS (row) == PT
&& MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P (row)))
! && (row->y > this_scroll_margin
|| CHARPOS (startp) == BEGV))
{
xassert (row->enabled_p);
--- 11344,11350 ----
&& (MATRIX_ROW_START_CHARPOS (row) > PT
|| (MATRIX_ROW_START_CHARPOS (row) == PT
&& MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P (row)))
! && (row->y > top_scroll_margin
|| CHARPOS (startp) == BEGV))
{
xassert (row->enabled_p);
***************
*** 11368,11374 ****
++row;
/* If within the scroll margin, scroll. */
! if (row->y < this_scroll_margin
&& CHARPOS (startp) != BEGV)
scroll_p = 1;
}
--- 11372,11378 ----
++row;
/* If within the scroll margin, scroll. */
! if (row->y < top_scroll_margin
&& CHARPOS (startp) != BEGV)
scroll_p = 1;
}
***************
*** 12538,12546 ****
position. */
if (pt_row)
{
! w->cursor.vpos -= MATRIX_ROW_VPOS (first_reusable_row,
! w->current_matrix);
! w->cursor.y -= first_reusable_row->y;
}
/* Scroll the display. */
--- 12542,12549 ----
position. */
if (pt_row)
{
! w->cursor.vpos -= nrows_scrolled;
! w->cursor.y -= first_reusable_row->y - start_row->y;
}
/* Scroll the display. */
***************
*** 12585,12590 ****
--- 12588,12616 ----
for (row -= nrows_scrolled; row < bottom_row; ++row)
row->enabled_p = 0;
+ /* Point may have moved to a different line, so we cannot assume that
+ the previous cursor position is valid; locate the correct row. */
+ if (pt_row)
+ {
+ for (row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
+ row < bottom_row && PT >= MATRIX_ROW_END_CHARPOS (row);
+ row++)
+ {
+ w->cursor.vpos++;
+ w->cursor.y = row->y;
+ }
+ if (row < bottom_row)
+ {
+ struct glyph *glyph = row->glyphs[TEXT_AREA] + w->cursor.hpos;
+ while (glyph->charpos < PT)
+ {
+ w->cursor.hpos++;
+ w->cursor.x += glyph->pixel_width;
+ glyph++;
+ }
+ }
+ }
+
/* Adjust window end. A null value of last_text_row means that
the window end is in reused rows which in turn means that
only its vpos can have changed. */
***************
*** 13368,13376 ****
if ((w->cursor.y < this_scroll_margin
&& CHARPOS (start) > BEGV)
! /* Don't take scroll margin into account at the bottom because
! old redisplay didn't do it either. */
! || w->cursor.y + cursor_height > it.last_visible_y)
{
w->cursor.vpos = -1;
clear_glyph_matrix (w->desired_matrix);
--- 13394,13402 ----
if ((w->cursor.y < this_scroll_margin
&& CHARPOS (start) > BEGV)
! /* Old redisplay didn't take scroll margin into account at the bottom,
! but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */
! || w->cursor.y + cursor_height + this_scroll_margin > it.last_visible_y)
{
w->cursor.vpos = -1;
clear_glyph_matrix (w->desired_matrix);