aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2004-04-13 21:31:23 +0000
committerKim F. Storm2004-04-13 21:31:23 +0000
commitcb9d4a9f656c51cf15805f3746ea86a6d07c059d (patch)
treea57bbf8c01306c4c07da57e5fda9c70c13364d93 /src
parented8226ea4141cb16a8392e2106ecf428fa56f1e0 (diff)
downloademacs-cb9d4a9f656c51cf15805f3746ea86a6d07c059d.tar.gz
emacs-cb9d4a9f656c51cf15805f3746ea86a6d07c059d.zip
(get_glyph_string_clip_rect): Fix reduction of cursor
height to glyph height when cursor row is not fully visible. (make_cursor_line_fully_visible): Add FORCE_P arg to return failure in case row is higher than window. Callers changed. (try_scrolling): Fix loop in scrolling if last_line_misfit (from Gerd). Try to scroll partially visible, higher-than-window cursor row. (redisplay_window): Always try to scroll partially visible, higher-than-window cursor row - both initially and again with centering_position = 0. Clear desired matrix before retrying with centering_position = 0.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 9c0434a681d..b1633132214 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -850,7 +850,7 @@ static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *,
850 Lisp_Object)); 850 Lisp_Object));
851static void extend_face_to_end_of_line P_ ((struct it *)); 851static void extend_face_to_end_of_line P_ ((struct it *));
852static int append_space P_ ((struct it *, int)); 852static int append_space P_ ((struct it *, int));
853static int make_cursor_line_fully_visible P_ ((struct window *)); 853static int make_cursor_line_fully_visible P_ ((struct window *, int));
854static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int, int)); 854static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int, int));
855static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *)); 855static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *));
856static int trailing_whitespace_p P_ ((int)); 856static int trailing_whitespace_p P_ ((int));
@@ -1793,8 +1793,9 @@ get_glyph_string_clip_rect (s, nr)
1793 height = max (FRAME_LINE_HEIGHT (s->f), glyph->ascent + glyph->descent); 1793 height = max (FRAME_LINE_HEIGHT (s->f), glyph->ascent + glyph->descent);
1794 if (height < r.height) 1794 if (height < r.height)
1795 { 1795 {
1796 r.y = s->ybase + glyph->descent - height; 1796 int max_y = r.y + r.height;
1797 r.height = height; 1797 r.y = min (max_y, s->ybase + glyph->descent - height);
1798 r.height = min (max_y - r.y, height);
1798 } 1799 }
1799 } 1800 }
1800 1801
@@ -10733,12 +10734,17 @@ run_window_scroll_functions (window, startp)
10733 A value of 1 means there is nothing to be done. 10734 A value of 1 means there is nothing to be done.
10734 (Either the line is fully visible, or it cannot be made so, 10735 (Either the line is fully visible, or it cannot be made so,
10735 or we cannot tell.) 10736 or we cannot tell.)
10737
10738 If FORCE_P is non-zero, return 0 even if partial visible cursor row
10739 is higher than window.
10740
10736 A value of 0 means the caller should do scrolling 10741 A value of 0 means the caller should do scrolling
10737 as if point had gone off the screen. */ 10742 as if point had gone off the screen. */
10738 10743
10739static int 10744static int
10740make_cursor_line_fully_visible (w) 10745make_cursor_line_fully_visible (w, force_p)
10741 struct window *w; 10746 struct window *w;
10747 int force_p;
10742{ 10748{
10743 struct glyph_matrix *matrix; 10749 struct glyph_matrix *matrix;
10744 struct glyph_row *row; 10750 struct glyph_row *row;
@@ -10756,6 +10762,9 @@ make_cursor_line_fully_visible (w)
10756 if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (row)) 10762 if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (row))
10757 return 1; 10763 return 1;
10758 10764
10765 if (force_p)
10766 return 0;
10767
10759 /* If the row the cursor is in is taller than the window's height, 10768 /* If the row the cursor is in is taller than the window's height,
10760 it's not clear what to do, so do nothing. */ 10769 it's not clear what to do, so do nothing. */
10761 window_height = window_box_height (w); 10770 window_height = window_box_height (w);
@@ -10852,7 +10861,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
10852 int amount_to_scroll = 0; 10861 int amount_to_scroll = 0;
10853 Lisp_Object aggressive; 10862 Lisp_Object aggressive;
10854 int height; 10863 int height;
10855 int end_scroll_margin; 10864 int extra_scroll_margin_lines = last_line_misfit ? 1 : 0;
10856 10865
10857#if GLYPH_DEBUG 10866#if GLYPH_DEBUG
10858 debug_method_add (w, "try_scrolling"); 10867 debug_method_add (w, "try_scrolling");
@@ -10895,11 +10904,13 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
10895 CHARPOS (scroll_margin_pos) = XINT (window_end); 10904 CHARPOS (scroll_margin_pos) = XINT (window_end);
10896 BYTEPOS (scroll_margin_pos) = CHAR_TO_BYTE (CHARPOS (scroll_margin_pos)); 10905 BYTEPOS (scroll_margin_pos) = CHAR_TO_BYTE (CHARPOS (scroll_margin_pos));
10897 10906
10898 end_scroll_margin = this_scroll_margin + !!last_line_misfit; 10907 if (this_scroll_margin || extra_scroll_margin_lines)
10899 if (end_scroll_margin)
10900 { 10908 {
10901 start_display (&it, w, scroll_margin_pos); 10909 start_display (&it, w, scroll_margin_pos);
10902 move_it_vertically (&it, - end_scroll_margin); 10910 if (this_scroll_margin)
10911 move_it_vertically (&it, - this_scroll_margin);
10912 if (extra_scroll_margin_lines)
10913 move_it_by_lines (&it, - extra_scroll_margin_lines, 0);
10903 scroll_margin_pos = it.current.pos; 10914 scroll_margin_pos = it.current.pos;
10904 } 10915 }
10905 10916
@@ -11034,10 +11045,10 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
11034 11045
11035 /* If cursor ends up on a partially visible line, 11046 /* If cursor ends up on a partially visible line,
11036 treat that as being off the bottom of the screen. */ 11047 treat that as being off the bottom of the screen. */
11037 if (! make_cursor_line_fully_visible (w)) 11048 if (! make_cursor_line_fully_visible (w, extra_scroll_margin_lines <= 1))
11038 { 11049 {
11039 clear_glyph_matrix (w->desired_matrix); 11050 clear_glyph_matrix (w->desired_matrix);
11040 last_line_misfit = 1; 11051 ++extra_scroll_margin_lines;
11041 goto too_near_end; 11052 goto too_near_end;
11042 } 11053 }
11043 rc = SCROLLING_SUCCESS; 11054 rc = SCROLLING_SUCCESS;
@@ -11326,7 +11337,7 @@ try_cursor_movement (window, startp, scroll_step)
11326 else 11337 else
11327 { 11338 {
11328 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); 11339 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
11329 if (!make_cursor_line_fully_visible (w)) 11340 if (!make_cursor_line_fully_visible (w, 0))
11330 rc = CURSOR_MOVEMENT_MUST_SCROLL; 11341 rc = CURSOR_MOVEMENT_MUST_SCROLL;
11331 else 11342 else
11332 rc = CURSOR_MOVEMENT_SUCCESS; 11343 rc = CURSOR_MOVEMENT_SUCCESS;
@@ -11657,7 +11668,7 @@ redisplay_window (window, just_this_one_p)
11657 new_vpos = window_box_height (w) / 2; 11668 new_vpos = window_box_height (w) / 2;
11658 } 11669 }
11659 11670
11660 if (!make_cursor_line_fully_visible (w)) 11671 if (!make_cursor_line_fully_visible (w, 0))
11661 { 11672 {
11662 /* Point does appear, but on a line partly visible at end of window. 11673 /* Point does appear, but on a line partly visible at end of window.
11663 Move it back to a fully-visible line. */ 11674 Move it back to a fully-visible line. */
@@ -11794,7 +11805,7 @@ redisplay_window (window, just_this_one_p)
11794 /* Forget any recorded base line for line number display. */ 11805 /* Forget any recorded base line for line number display. */
11795 w->base_line_number = Qnil; 11806 w->base_line_number = Qnil;
11796 11807
11797 if (!make_cursor_line_fully_visible (w)) 11808 if (!make_cursor_line_fully_visible (w, 1))
11798 { 11809 {
11799 clear_glyph_matrix (w->desired_matrix); 11810 clear_glyph_matrix (w->desired_matrix);
11800 last_line_misfit = 1; 11811 last_line_misfit = 1;
@@ -11954,7 +11965,7 @@ redisplay_window (window, just_this_one_p)
11954 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); 11965 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
11955 } 11966 }
11956 11967
11957 if (!make_cursor_line_fully_visible (w)) 11968 if (!make_cursor_line_fully_visible (w, centering_position > 0))
11958 { 11969 {
11959 /* If vscroll is enabled, disable it and try again. */ 11970 /* If vscroll is enabled, disable it and try again. */
11960 if (w->vscroll) 11971 if (w->vscroll)
@@ -11967,6 +11978,7 @@ redisplay_window (window, just_this_one_p)
11967 /* If centering point failed to make the whole line visible, 11978 /* If centering point failed to make the whole line visible,
11968 put point at the top instead. That has to make the whole line 11979 put point at the top instead. That has to make the whole line
11969 visible, if it can be done. */ 11980 visible, if it can be done. */
11981 clear_glyph_matrix (w->desired_matrix);
11970 centering_position = 0; 11982 centering_position = 0;
11971 goto point_at_top; 11983 goto point_at_top;
11972 } 11984 }