diff options
| author | Richard M. Stallman | 2003-01-06 00:58:45 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-01-06 00:58:45 +0000 |
| commit | 03b0a4b4111b8139cbe932ba7d278c4cb2decefd (patch) | |
| tree | b13350b71130c25a9d4e3792e08da2941875bc54 /src | |
| parent | 5d55ffd05d2e689f6a2b249d94270c966bac7c72 (diff) | |
| download | emacs-03b0a4b4111b8139cbe932ba7d278c4cb2decefd.tar.gz emacs-03b0a4b4111b8139cbe932ba7d278c4cb2decefd.zip | |
(try_scrolling): New arg LAST_LINE_MISFIT.
Count LAST_LINE_MISFIT in scroll margin for end of window.
Move label too_near_end before setting SCROLL_MARGIN_POS.
Set LAST_LINE_MISFIT before jumping there.
(try_scrolling): Calculate amount_to_scroll better in
scroll_conservatively case. If scrolling that much doesn't change
STARTP, move it down one line.
(setup_echo_area_for_printing): Kill Emacs if no selected frame.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 1feb3830b25..cdf9d38df5a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -770,7 +770,7 @@ static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *)); | |||
| 770 | static void extend_face_to_end_of_line P_ ((struct it *)); | 770 | static void extend_face_to_end_of_line P_ ((struct it *)); |
| 771 | static int append_space P_ ((struct it *, int)); | 771 | static int append_space P_ ((struct it *, int)); |
| 772 | static int make_cursor_line_fully_visible P_ ((struct window *)); | 772 | static int make_cursor_line_fully_visible P_ ((struct window *)); |
| 773 | static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int)); | 773 | static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int, int)); |
| 774 | static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *)); | 774 | static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *)); |
| 775 | static int trailing_whitespace_p P_ ((int)); | 775 | static int trailing_whitespace_p P_ ((int)); |
| 776 | static int message_log_check_duplicate P_ ((int, int, int, int)); | 776 | static int message_log_check_duplicate P_ ((int, int, int, int)); |
| @@ -6488,6 +6488,10 @@ void | |||
| 6488 | setup_echo_area_for_printing (multibyte_p) | 6488 | setup_echo_area_for_printing (multibyte_p) |
| 6489 | int multibyte_p; | 6489 | int multibyte_p; |
| 6490 | { | 6490 | { |
| 6491 | /* If we can't find an echo area any more, exit. */ | ||
| 6492 | if (! FRAME_LIVE_P (XFRAME (selected_frame))) | ||
| 6493 | Fkill_emacs (Qnil); | ||
| 6494 | |||
| 6491 | ensure_echo_area_buffers (); | 6495 | ensure_echo_area_buffers (); |
| 6492 | 6496 | ||
| 6493 | if (!message_buf_print) | 6497 | if (!message_buf_print) |
| @@ -9609,6 +9613,9 @@ make_cursor_line_fully_visible (w) | |||
| 9609 | in redisplay_window to bring a partially visible line into view in | 9613 | in redisplay_window to bring a partially visible line into view in |
| 9610 | the case that only the cursor has moved. | 9614 | the case that only the cursor has moved. |
| 9611 | 9615 | ||
| 9616 | LAST_LINE_MISFIT should be nonzero if we're scrolling because the | ||
| 9617 | last screen line's vertical height extends past the end of the screen. | ||
| 9618 | |||
| 9612 | Value is | 9619 | Value is |
| 9613 | 9620 | ||
| 9614 | 1 if scrolling succeeded | 9621 | 1 if scrolling succeeded |
| @@ -9627,11 +9634,12 @@ enum | |||
| 9627 | 9634 | ||
| 9628 | static int | 9635 | static int |
| 9629 | try_scrolling (window, just_this_one_p, scroll_conservatively, | 9636 | try_scrolling (window, just_this_one_p, scroll_conservatively, |
| 9630 | scroll_step, temp_scroll_step) | 9637 | scroll_step, temp_scroll_step, last_line_misfit) |
| 9631 | Lisp_Object window; | 9638 | Lisp_Object window; |
| 9632 | int just_this_one_p; | 9639 | int just_this_one_p; |
| 9633 | EMACS_INT scroll_conservatively, scroll_step; | 9640 | EMACS_INT scroll_conservatively, scroll_step; |
| 9634 | int temp_scroll_step; | 9641 | int temp_scroll_step; |
| 9642 | int last_line_misfit; | ||
| 9635 | { | 9643 | { |
| 9636 | struct window *w = XWINDOW (window); | 9644 | struct window *w = XWINDOW (window); |
| 9637 | struct frame *f = XFRAME (w->frame); | 9645 | struct frame *f = XFRAME (w->frame); |
| @@ -9647,6 +9655,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, | |||
| 9647 | int amount_to_scroll = 0; | 9655 | int amount_to_scroll = 0; |
| 9648 | Lisp_Object aggressive; | 9656 | Lisp_Object aggressive; |
| 9649 | int height; | 9657 | int height; |
| 9658 | int end_scroll_margin; | ||
| 9650 | 9659 | ||
| 9651 | #if GLYPH_DEBUG | 9660 | #if GLYPH_DEBUG |
| 9652 | debug_method_add (w, "try_scrolling"); | 9661 | debug_method_add (w, "try_scrolling"); |
| @@ -9683,12 +9692,17 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, | |||
| 9683 | and move this_scroll_margin up to find the position of the scroll | 9692 | and move this_scroll_margin up to find the position of the scroll |
| 9684 | margin. */ | 9693 | margin. */ |
| 9685 | window_end = Fwindow_end (window, Qt); | 9694 | window_end = Fwindow_end (window, Qt); |
| 9695 | |||
| 9696 | too_near_end: | ||
| 9697 | |||
| 9686 | CHARPOS (scroll_margin_pos) = XINT (window_end); | 9698 | CHARPOS (scroll_margin_pos) = XINT (window_end); |
| 9687 | BYTEPOS (scroll_margin_pos) = CHAR_TO_BYTE (CHARPOS (scroll_margin_pos)); | 9699 | BYTEPOS (scroll_margin_pos) = CHAR_TO_BYTE (CHARPOS (scroll_margin_pos)); |
| 9688 | if (this_scroll_margin) | 9700 | |
| 9701 | end_scroll_margin = this_scroll_margin + !!last_line_misfit; | ||
| 9702 | if (end_scroll_margin) | ||
| 9689 | { | 9703 | { |
| 9690 | start_display (&it, w, scroll_margin_pos); | 9704 | start_display (&it, w, scroll_margin_pos); |
| 9691 | move_it_vertically (&it, - this_scroll_margin); | 9705 | move_it_vertically (&it, - end_scroll_margin); |
| 9692 | scroll_margin_pos = it.current.pos; | 9706 | scroll_margin_pos = it.current.pos; |
| 9693 | } | 9707 | } |
| 9694 | 9708 | ||
| @@ -9696,7 +9710,6 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, | |||
| 9696 | { | 9710 | { |
| 9697 | int y0; | 9711 | int y0; |
| 9698 | 9712 | ||
| 9699 | too_near_end: | ||
| 9700 | /* Point is in the scroll margin at the bottom of the window, or | 9713 | /* Point is in the scroll margin at the bottom of the window, or |
| 9701 | below. Compute a new window start that makes point visible. */ | 9714 | below. Compute a new window start that makes point visible. */ |
| 9702 | 9715 | ||
| @@ -9721,9 +9734,11 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, | |||
| 9721 | start_display (&it, w, startp); | 9734 | start_display (&it, w, startp); |
| 9722 | 9735 | ||
| 9723 | if (scroll_conservatively) | 9736 | if (scroll_conservatively) |
| 9737 | /* Set AMOUNT_TO_SCROLL to at least one line, | ||
| 9738 | and at most scroll_conservatively lines. */ | ||
| 9724 | amount_to_scroll | 9739 | amount_to_scroll |
| 9725 | = max (max (dy, CANON_Y_UNIT (f)), | 9740 | = min (max (dy, CANON_Y_UNIT (f)), |
| 9726 | CANON_Y_UNIT (f) * max (scroll_step, temp_scroll_step)); | 9741 | CANON_Y_UNIT (f) * scroll_conservatively); |
| 9727 | else if (scroll_step || temp_scroll_step) | 9742 | else if (scroll_step || temp_scroll_step) |
| 9728 | amount_to_scroll = scroll_max; | 9743 | amount_to_scroll = scroll_max; |
| 9729 | else | 9744 | else |
| @@ -9738,7 +9753,12 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, | |||
| 9738 | if (amount_to_scroll <= 0) | 9753 | if (amount_to_scroll <= 0) |
| 9739 | return SCROLLING_FAILED; | 9754 | return SCROLLING_FAILED; |
| 9740 | 9755 | ||
| 9756 | /* If moving by amount_to_scroll leaves STARTP unchanged, | ||
| 9757 | move it down one screen line. */ | ||
| 9758 | |||
| 9741 | move_it_vertically (&it, amount_to_scroll); | 9759 | move_it_vertically (&it, amount_to_scroll); |
| 9760 | if (CHARPOS (it.current.pos) == CHARPOS (startp)) | ||
| 9761 | move_it_by_lines (&it, 1, 1); | ||
| 9742 | startp = it.current.pos; | 9762 | startp = it.current.pos; |
| 9743 | } | 9763 | } |
| 9744 | else | 9764 | else |
| @@ -9822,6 +9842,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, | |||
| 9822 | if (! make_cursor_line_fully_visible (w)) | 9842 | if (! make_cursor_line_fully_visible (w)) |
| 9823 | { | 9843 | { |
| 9824 | clear_glyph_matrix (w->desired_matrix); | 9844 | clear_glyph_matrix (w->desired_matrix); |
| 9845 | last_line_misfit = 1; | ||
| 9825 | goto too_near_end; | 9846 | goto too_near_end; |
| 9826 | } | 9847 | } |
| 9827 | rc = SCROLLING_SUCCESS; | 9848 | rc = SCROLLING_SUCCESS; |
| @@ -10160,6 +10181,7 @@ redisplay_window (window, just_this_one_p) | |||
| 10160 | int count = SPECPDL_INDEX (); | 10181 | int count = SPECPDL_INDEX (); |
| 10161 | int rc; | 10182 | int rc; |
| 10162 | int centering_position; | 10183 | int centering_position; |
| 10184 | int last_line_misfit = 0; | ||
| 10163 | 10185 | ||
| 10164 | SET_TEXT_POS (lpoint, PT, PT_BYTE); | 10186 | SET_TEXT_POS (lpoint, PT, PT_BYTE); |
| 10165 | opoint = lpoint; | 10187 | opoint = lpoint; |
| @@ -10530,7 +10552,10 @@ redisplay_window (window, just_this_one_p) | |||
| 10530 | w->base_line_number = Qnil; | 10552 | w->base_line_number = Qnil; |
| 10531 | 10553 | ||
| 10532 | if (!make_cursor_line_fully_visible (w)) | 10554 | if (!make_cursor_line_fully_visible (w)) |
| 10533 | clear_glyph_matrix (w->desired_matrix); | 10555 | { |
| 10556 | clear_glyph_matrix (w->desired_matrix); | ||
| 10557 | last_line_misfit = 1; | ||
| 10558 | } | ||
| 10534 | /* Drop through and scroll. */ | 10559 | /* Drop through and scroll. */ |
| 10535 | else | 10560 | else |
| 10536 | goto done; | 10561 | goto done; |
| @@ -10566,7 +10591,7 @@ redisplay_window (window, just_this_one_p) | |||
| 10566 | int rc = try_scrolling (window, just_this_one_p, | 10591 | int rc = try_scrolling (window, just_this_one_p, |
| 10567 | scroll_conservatively, | 10592 | scroll_conservatively, |
| 10568 | scroll_step, | 10593 | scroll_step, |
| 10569 | temp_scroll_step); | 10594 | temp_scroll_step, last_line_misfit); |
| 10570 | switch (rc) | 10595 | switch (rc) |
| 10571 | { | 10596 | { |
| 10572 | case SCROLLING_SUCCESS: | 10597 | case SCROLLING_SUCCESS: |