diff options
| author | Miles Bader | 2005-01-24 22:34:31 +0000 |
|---|---|---|
| committer | Miles Bader | 2005-01-24 22:34:31 +0000 |
| commit | 87795686a9e8ea51ec492d01d7dce4698b14f3af (patch) | |
| tree | 737f41796d19fc2dae8a9b77ecf372ae9cca9f01 /src | |
| parent | 7ed0a705d1cf6dcf340b3407bbffd21f1cfbc925 (diff) | |
| parent | 6adb6f01302f35954f3b50bbf8ae8d94af268792 (diff) | |
| download | emacs-87795686a9e8ea51ec492d01d7dce4698b14f3af.tar.gz emacs-87795686a9e8ea51ec492d01d7dce4698b14f3af.zip | |
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-6
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-48
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-51
Update from CVS
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 50 | ||||
| -rw-r--r-- | src/dispextern.h | 5 | ||||
| -rw-r--r-- | src/indent.c | 8 | ||||
| -rw-r--r-- | src/macgui.h | 7 | ||||
| -rw-r--r-- | src/macterm.c | 105 | ||||
| -rw-r--r-- | src/window.c | 57 | ||||
| -rw-r--r-- | src/xdisp.c | 52 |
7 files changed, 221 insertions, 63 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 53f0d8722a8..e9a38a7d64c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,53 @@ | |||
| 1 | 2005-01-24 Kim F. Storm <storm@cua.dk> | ||
| 2 | |||
| 3 | * xdisp.c (move_it_by_lines): If we move forward after going too | ||
| 4 | far back, cancel move if end position is same as start position. | ||
| 5 | |||
| 6 | 2005-01-24 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 7 | |||
| 8 | * dispextern.h (struct glyph_string): New members clip_head and | ||
| 9 | clip_tail. | ||
| 10 | |||
| 11 | * xdisp.c (get_glyph_string_clip_rect): Restrict horizontal clip | ||
| 12 | region to the area between clip_head and clip_tail. | ||
| 13 | (draw_glyphs): Record the area that need to be actually redrawn to | ||
| 14 | the new variables clip_head and clip_tail when there are | ||
| 15 | overhangs. Set values of these variables to the corresponding | ||
| 16 | members in struct glyph_string. Refine x coordinates for | ||
| 17 | notice_overwritten_cursor using clip_head and clip_tail. | ||
| 18 | |||
| 19 | * macgui.h (STORE_XCHARSETSTRUCT): New macro. | ||
| 20 | |||
| 21 | * macterm.c (mac_compute_glyph_string_overhangs): Implement with | ||
| 22 | QDTextBounds. | ||
| 23 | (x_draw_glyph_string): Don't fill the background of the successor | ||
| 24 | of a glyph with a right overhang if the successor will draw a cursor. | ||
| 25 | (XLoadQueryFont): Obtain font metrics using QDTextBounds. | ||
| 26 | (x_redisplay_interface): Add entry for compute_glyph_string_overhangs. | ||
| 27 | |||
| 28 | 2005-01-24 Kim F. Storm <storm@cua.dk> | ||
| 29 | |||
| 30 | * window.c (window_scroll_pixel_based): Fix scrolling in the wrong | ||
| 31 | direction if window height was smaller than next-screen-context-lines. | ||
| 32 | Now always scroll at least one line in the requested direction. | ||
| 33 | Ensure that we actually do scroll backwards when requested to do so. | ||
| 34 | |||
| 35 | * xdisp.c (redisplay_window): Only try to make cursor line fully | ||
| 36 | visible once (to avoid redisplay loop). | ||
| 37 | |||
| 38 | 2005-01-23 Kim F. Storm <storm@cua.dk> | ||
| 39 | |||
| 40 | * window.c (Fpos_visible_in_window_p): Simplify return value for | ||
| 41 | partially visible rows. | ||
| 42 | (window_scroll_pixel_based): Adapt to that change. | ||
| 43 | |||
| 44 | * window.c (window_scroll_pixel_based): Force moving to next line | ||
| 45 | if scrolling doesn't move start point, e.g. if looking at tall image. | ||
| 46 | |||
| 47 | * xdisp.c (pos_visible_p): Return 0 if non-interactive. | ||
| 48 | Clear last_height before calling line_bottom_y to get real height. | ||
| 49 | Fix calculation of y. | ||
| 50 | |||
| 1 | 2005-01-22 Steven Tamm <steventamm@mac.com> | 51 | 2005-01-22 Steven Tamm <steventamm@mac.com> |
| 2 | 52 | ||
| 3 | * s/darwin.h: Removed PTY_ITERATION from here. | 53 | * s/darwin.h: Removed PTY_ITERATION from here. |
diff --git a/src/dispextern.h b/src/dispextern.h index 8a24551260d..ac56cdd31f2 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -1193,6 +1193,11 @@ struct glyph_string | |||
| 1193 | /* Slice */ | 1193 | /* Slice */ |
| 1194 | struct glyph_slice slice; | 1194 | struct glyph_slice slice; |
| 1195 | 1195 | ||
| 1196 | /* Non-null means the horizontal clipping region starts from the | ||
| 1197 | left edge of *clip_head, and ends with the right edge of | ||
| 1198 | *clip_tail, not including their overhangs. */ | ||
| 1199 | struct glyph_string *clip_head, *clip_tail; | ||
| 1200 | |||
| 1196 | struct glyph_string *next, *prev; | 1201 | struct glyph_string *next, *prev; |
| 1197 | }; | 1202 | }; |
| 1198 | 1203 | ||
diff --git a/src/indent.c b/src/indent.c index 1d69d346f92..8b8bf924a94 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Indentation functions. | 1 | /* Indentation functions. |
| 2 | Copyright (C) 1985,86,87,88,93,94,95,98,2000,01,02,03,2004 | 2 | Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1998, 2000, 2001, |
| 3 | Free Software Foundation, Inc. | 3 | 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -340,7 +340,9 @@ will have a variable width) | |||
| 340 | Ignores finite width of frame, which means that this function may return | 340 | Ignores finite width of frame, which means that this function may return |
| 341 | values greater than (frame-width). | 341 | values greater than (frame-width). |
| 342 | Whether the line is visible (if `selective-display' is t) has no effect; | 342 | Whether the line is visible (if `selective-display' is t) has no effect; |
| 343 | however, ^M is treated as end of line when `selective-display' is t. */) | 343 | however, ^M is treated as end of line when `selective-display' is t. |
| 344 | Text that has an invisible property is considered as having width 0, unless | ||
| 345 | `buffer-invisibility-spec' specifies that it is replaced by an ellipsis. */) | ||
| 344 | () | 346 | () |
| 345 | { | 347 | { |
| 346 | Lisp_Object temp; | 348 | Lisp_Object temp; |
diff --git a/src/macgui.h b/src/macgui.h index 1e1447dfaa8..cb157bb8c25 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -92,6 +92,13 @@ typedef struct _XCharStruct | |||
| 92 | int descent; | 92 | int descent; |
| 93 | } XCharStruct; | 93 | } XCharStruct; |
| 94 | 94 | ||
| 95 | #define STORE_XCHARSTRUCT(xcs, w, bds) \ | ||
| 96 | ((xcs).width = (w), \ | ||
| 97 | (xcs).lbearing = (bds).left, \ | ||
| 98 | (xcs).rbearing = (bds).right, \ | ||
| 99 | (xcs).ascent = -(bds).top, \ | ||
| 100 | (xcs).descent = (bds).bottom) | ||
| 101 | |||
| 95 | struct MacFontStruct { | 102 | struct MacFontStruct { |
| 96 | char *fontname; | 103 | char *fontname; |
| 97 | 104 | ||
diff --git a/src/macterm.c b/src/macterm.c index d083252d90c..9a1ee834ce5 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -1997,20 +1997,33 @@ static void | |||
| 1997 | mac_compute_glyph_string_overhangs (s) | 1997 | mac_compute_glyph_string_overhangs (s) |
| 1998 | struct glyph_string *s; | 1998 | struct glyph_string *s; |
| 1999 | { | 1999 | { |
| 2000 | #if 0 | 2000 | Rect r; |
| 2001 | /* MAC_TODO: XTextExtents16 does nothing yet... */ | 2001 | MacFontStruct *font = s->font; |
| 2002 | |||
| 2003 | TextFont (font->mac_fontnum); | ||
| 2004 | TextSize (font->mac_fontsize); | ||
| 2005 | TextFace (font->mac_fontface); | ||
| 2002 | 2006 | ||
| 2003 | if (s->cmp == NULL | 2007 | if (s->two_byte_p) |
| 2004 | && s->first_glyph->type == CHAR_GLYPH) | 2008 | QDTextBounds (s->nchars * 2, (char *)s->char2b, &r); |
| 2009 | else | ||
| 2005 | { | 2010 | { |
| 2006 | XCharStruct cs; | 2011 | int i; |
| 2007 | int direction, font_ascent, font_descent; | 2012 | char *buf = xmalloc (s->nchars); |
| 2008 | XTextExtents16 (s->font, s->char2b, s->nchars, &direction, | 2013 | |
| 2009 | &font_ascent, &font_descent, &cs); | 2014 | if (buf == NULL) |
| 2010 | s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0; | 2015 | SetRect (&r, 0, 0, 0, 0); |
| 2011 | s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0; | 2016 | else |
| 2017 | { | ||
| 2018 | for (i = 0; i < s->nchars; ++i) | ||
| 2019 | buf[i] = s->char2b[i].byte2; | ||
| 2020 | QDTextBounds (s->nchars, buf, &r); | ||
| 2021 | xfree (buf); | ||
| 2022 | } | ||
| 2012 | } | 2023 | } |
| 2013 | #endif | 2024 | |
| 2025 | s->right_overhang = r.right > s->width ? r.right - s->width : 0; | ||
| 2026 | s->left_overhang = r.left < 0 ? -r.left : 0; | ||
| 2014 | } | 2027 | } |
| 2015 | 2028 | ||
| 2016 | 2029 | ||
| @@ -3078,10 +3091,12 @@ x_draw_glyph_string (s) | |||
| 3078 | { | 3091 | { |
| 3079 | int relief_drawn_p = 0; | 3092 | int relief_drawn_p = 0; |
| 3080 | 3093 | ||
| 3081 | /* If S draws into the background of its successor, draw the | 3094 | /* If S draws into the background of its successor that does not |
| 3082 | background of the successor first so that S can draw into it. | 3095 | draw a cursor, draw the background of the successor first so that |
| 3083 | This makes S->next use XDrawString instead of XDrawImageString. */ | 3096 | S can draw into it. This makes S->next use XDrawString instead |
| 3084 | if (s->next && s->right_overhang && !s->for_overlaps_p) | 3097 | of XDrawImageString. */ |
| 3098 | if (s->next && s->right_overhang && !s->for_overlaps_p | ||
| 3099 | && s->next->hl != DRAW_CURSOR) | ||
| 3085 | { | 3100 | { |
| 3086 | xassert (s->next->img == NULL); | 3101 | xassert (s->next->img == NULL); |
| 3087 | x_set_glyph_string_gc (s->next); | 3102 | x_set_glyph_string_gc (s->next); |
| @@ -6780,30 +6795,40 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 6780 | returns 15 for 12-point Monaco! */ | 6795 | returns 15 for 12-point Monaco! */ |
| 6781 | char_width = CharWidth ('m'); | 6796 | char_width = CharWidth ('m'); |
| 6782 | 6797 | ||
| 6783 | font->max_bounds.rbearing = char_width; | 6798 | if (is_two_byte_font) |
| 6784 | font->max_bounds.lbearing = 0; | 6799 | { |
| 6785 | font->max_bounds.width = char_width; | 6800 | font->per_char = NULL; |
| 6786 | font->max_bounds.ascent = the_fontinfo.ascent; | ||
| 6787 | font->max_bounds.descent = the_fontinfo.descent; | ||
| 6788 | 6801 | ||
| 6789 | font->min_bounds = font->max_bounds; | 6802 | if (fontface & italic) |
| 6803 | font->max_bounds.rbearing = char_width + 1; | ||
| 6804 | else | ||
| 6805 | font->max_bounds.rbearing = char_width; | ||
| 6806 | font->max_bounds.lbearing = 0; | ||
| 6807 | font->max_bounds.width = char_width; | ||
| 6808 | font->max_bounds.ascent = the_fontinfo.ascent; | ||
| 6809 | font->max_bounds.descent = the_fontinfo.descent; | ||
| 6790 | 6810 | ||
| 6791 | if (is_two_byte_font || CharWidth ('m') == CharWidth ('i')) | 6811 | font->min_bounds = font->max_bounds; |
| 6792 | font->per_char = NULL; | 6812 | } |
| 6793 | else | 6813 | else |
| 6794 | { | 6814 | { |
| 6795 | font->per_char = (XCharStruct *) | 6815 | font->per_char = (XCharStruct *) |
| 6796 | xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); | 6816 | xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); |
| 6797 | { | 6817 | { |
| 6798 | int c, min_width, max_width; | 6818 | int c, min_width, max_width; |
| 6819 | Rect char_bounds, min_bounds, max_bounds; | ||
| 6820 | char ch; | ||
| 6799 | 6821 | ||
| 6800 | min_width = max_width = char_width; | 6822 | min_width = max_width = char_width; |
| 6823 | SetRect (&min_bounds, -32767, -32767, 32767, 32767); | ||
| 6824 | SetRect (&max_bounds, 0, 0, 0, 0); | ||
| 6801 | for (c = 0x20; c <= 0xff; c++) | 6825 | for (c = 0x20; c <= 0xff; c++) |
| 6802 | { | 6826 | { |
| 6803 | font->per_char[c - 0x20] = font->max_bounds; | 6827 | ch = c; |
| 6804 | char_width = CharWidth (c); | 6828 | char_width = CharWidth (ch); |
| 6805 | font->per_char[c - 0x20].width = char_width; | 6829 | QDTextBounds (1, &ch, &char_bounds); |
| 6806 | font->per_char[c - 0x20].rbearing = char_width; | 6830 | STORE_XCHARSTRUCT (font->per_char[c - 0x20], |
| 6831 | char_width, char_bounds); | ||
| 6807 | /* Some Japanese fonts (in SJIS encoding) return 0 as the | 6832 | /* Some Japanese fonts (in SJIS encoding) return 0 as the |
| 6808 | character width of 0x7f. */ | 6833 | character width of 0x7f. */ |
| 6809 | if (char_width > 0) | 6834 | if (char_width > 0) |
| @@ -6811,9 +6836,25 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 6811 | min_width = min (min_width, char_width); | 6836 | min_width = min (min_width, char_width); |
| 6812 | max_width = max (max_width, char_width); | 6837 | max_width = max (max_width, char_width); |
| 6813 | } | 6838 | } |
| 6814 | } | 6839 | if (!EmptyRect (&char_bounds)) |
| 6815 | font->min_bounds.width = min_width; | 6840 | { |
| 6816 | font->max_bounds.width = max_width; | 6841 | SetRect (&min_bounds, |
| 6842 | max (min_bounds.left, char_bounds.left), | ||
| 6843 | max (min_bounds.top, char_bounds.top), | ||
| 6844 | min (min_bounds.right, char_bounds.right), | ||
| 6845 | min (min_bounds.bottom, char_bounds.bottom)); | ||
| 6846 | UnionRect (&max_bounds, &char_bounds, &max_bounds); | ||
| 6847 | } | ||
| 6848 | } | ||
| 6849 | STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds); | ||
| 6850 | STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds); | ||
| 6851 | if (min_width == max_width | ||
| 6852 | && max_bounds.left >= 0 && max_bounds.right <= max_width) | ||
| 6853 | { | ||
| 6854 | /* Fixed width and no overhangs. */ | ||
| 6855 | xfree (font->per_char); | ||
| 6856 | font->per_char = NULL; | ||
| 6857 | } | ||
| 6817 | } | 6858 | } |
| 6818 | } | 6859 | } |
| 6819 | 6860 | ||
| @@ -9719,7 +9760,7 @@ static struct redisplay_interface x_redisplay_interface = | |||
| 9719 | 0, /* destroy_fringe_bitmap */ | 9760 | 0, /* destroy_fringe_bitmap */ |
| 9720 | mac_per_char_metric, | 9761 | mac_per_char_metric, |
| 9721 | mac_encode_char, | 9762 | mac_encode_char, |
| 9722 | NULL, /* mac_compute_glyph_string_overhangs */ | 9763 | mac_compute_glyph_string_overhangs, |
| 9723 | x_draw_glyph_string, | 9764 | x_draw_glyph_string, |
| 9724 | mac_define_frame_cursor, | 9765 | mac_define_frame_cursor, |
| 9725 | mac_clear_frame_area, | 9766 | mac_clear_frame_area, |
diff --git a/src/window.c b/src/window.c index 9b8a031f6c1..370251882ba 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -333,11 +333,10 @@ If POS is only out of view because of horizontal scrolling, return non-nil. | |||
| 333 | POS defaults to point in WINDOW; WINDOW defaults to the selected window. | 333 | POS defaults to point in WINDOW; WINDOW defaults to the selected window. |
| 334 | 334 | ||
| 335 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, | 335 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, |
| 336 | return value is a list (X Y FULLY [RTOP RBOT]) where X and Y are the pixel | 336 | return value is a list (X Y PARTIAL) where X and Y are the pixel coordinates |
| 337 | coordinates relative to the top left corner of the window, and FULLY is t if the | 337 | relative to the top left corner of the window. PARTIAL is nil if the character |
| 338 | character after POS is fully visible and nil otherwise. If FULLY is nil, | 338 | after POS is fully visible; otherwise it is a cons (RTOP . RBOT) where RTOP |
| 339 | RTOP and RBOT are the number of pixels invisible at the top and bottom row | 339 | and RBOT are the number of pixels invisible at the top and bottom of the row. */) |
| 340 | of the window. */) | ||
| 341 | (pos, window, partially) | 340 | (pos, window, partially) |
| 342 | Lisp_Object pos, window, partially; | 341 | Lisp_Object pos, window, partially; |
| 343 | { | 342 | { |
| @@ -376,12 +375,10 @@ of the window. */) | |||
| 376 | if (!NILP (in_window) && !NILP (partially)) | 375 | if (!NILP (in_window) && !NILP (partially)) |
| 377 | in_window = Fcons (make_number (x), | 376 | in_window = Fcons (make_number (x), |
| 378 | Fcons (make_number (y), | 377 | Fcons (make_number (y), |
| 379 | Fcons (fully_p ? Qt : Qnil, | 378 | Fcons ((fully_p ? Qnil |
| 380 | (fully_p | 379 | : Fcons (make_number (rtop), |
| 381 | ? Qnil | 380 | make_number (rbot))), |
| 382 | : Fcons (make_number (rtop), | 381 | Qnil))); |
| 383 | Fcons (make_number (rbot), | ||
| 384 | Qnil)))))); | ||
| 385 | return in_window; | 382 | return in_window; |
| 386 | } | 383 | } |
| 387 | 384 | ||
| @@ -4578,21 +4575,23 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4578 | } | 4575 | } |
| 4579 | else if (auto_window_vscroll_p) | 4576 | else if (auto_window_vscroll_p) |
| 4580 | { | 4577 | { |
| 4581 | if (NILP (XCAR (XCDR (XCDR (tem))))) | 4578 | if (tem = XCAR (XCDR (XCDR (tem))), CONSP (tem)) |
| 4582 | { | 4579 | { |
| 4583 | int px; | 4580 | int px; |
| 4584 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); | 4581 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); |
| 4585 | if (whole) | 4582 | if (whole) |
| 4586 | dy = window_box_height (w) - next_screen_context_lines * dy; | 4583 | dy = max ((window_box_height (w) |
| 4584 | - next_screen_context_lines * dy), | ||
| 4585 | dy); | ||
| 4587 | dy *= n; | 4586 | dy *= n; |
| 4588 | 4587 | ||
| 4589 | if (n < 0 && (px = XINT (Fnth (make_number (3), tem))) > 0) | 4588 | if (n < 0 && (px = XINT (XCAR (tem))) > 0) |
| 4590 | { | 4589 | { |
| 4591 | px = max (0, -w->vscroll - min (px, -dy)); | 4590 | px = max (0, -w->vscroll - min (px, -dy)); |
| 4592 | Fset_window_vscroll (window, make_number (px), Qt); | 4591 | Fset_window_vscroll (window, make_number (px), Qt); |
| 4593 | return; | 4592 | return; |
| 4594 | } | 4593 | } |
| 4595 | if (n > 0 && (px = XINT (Fnth (make_number (4), tem))) > 0) | 4594 | if (n > 0 && (px = XINT (XCDR (tem))) > 0) |
| 4596 | { | 4595 | { |
| 4597 | px = max (0, -w->vscroll + min (px, dy)); | 4596 | px = max (0, -w->vscroll + min (px, dy)); |
| 4598 | Fset_window_vscroll (window, make_number (px), Qt); | 4597 | Fset_window_vscroll (window, make_number (px), Qt); |
| @@ -4618,18 +4617,34 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4618 | start_display (&it, w, start); | 4617 | start_display (&it, w, start); |
| 4619 | if (whole) | 4618 | if (whole) |
| 4620 | { | 4619 | { |
| 4621 | int screen_full = (window_box_height (w) | 4620 | int start_pos = IT_CHARPOS (it); |
| 4622 | - next_screen_context_lines * FRAME_LINE_HEIGHT (it.f)); | 4621 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); |
| 4623 | int dy = n * screen_full; | 4622 | dy = max ((window_box_height (w) |
| 4623 | - next_screen_context_lines * dy), | ||
| 4624 | dy) * n; | ||
| 4624 | 4625 | ||
| 4625 | /* Note that move_it_vertically always moves the iterator to the | 4626 | /* Note that move_it_vertically always moves the iterator to the |
| 4626 | start of a line. So, if the last line doesn't have a newline, | 4627 | start of a line. So, if the last line doesn't have a newline, |
| 4627 | we would end up at the start of the line ending at ZV. */ | 4628 | we would end up at the start of the line ending at ZV. */ |
| 4628 | if (dy <= 0) | 4629 | if (dy <= 0) |
| 4629 | move_it_vertically_backward (&it, -dy); | 4630 | { |
| 4631 | move_it_vertically_backward (&it, -dy); | ||
| 4632 | /* Ensure we actually does move, e.g. in case we are currently | ||
| 4633 | looking at an image that is taller that the window height. */ | ||
| 4634 | while (start_pos == IT_CHARPOS (it) | ||
| 4635 | && start_pos > BEGV) | ||
| 4636 | move_it_by_lines (&it, -1, 1); | ||
| 4637 | } | ||
| 4630 | else if (dy > 0) | 4638 | else if (dy > 0) |
| 4631 | move_it_to (&it, ZV, -1, it.current_y + dy, -1, | 4639 | { |
| 4632 | MOVE_TO_POS | MOVE_TO_Y); | 4640 | move_it_to (&it, ZV, -1, it.current_y + dy, -1, |
| 4641 | MOVE_TO_POS | MOVE_TO_Y); | ||
| 4642 | /* Ensure we actually does move, e.g. in case we are currently | ||
| 4643 | looking at an image that is taller that the window height. */ | ||
| 4644 | while (start_pos == IT_CHARPOS (it) | ||
| 4645 | && start_pos < ZV) | ||
| 4646 | move_it_by_lines (&it, 1, 1); | ||
| 4647 | } | ||
| 4633 | } | 4648 | } |
| 4634 | else | 4649 | else |
| 4635 | move_it_by_lines (&it, n, 1); | 4650 | move_it_by_lines (&it, n, 1); |
diff --git a/src/xdisp.c b/src/xdisp.c index 6a59de7ef8d..a8f36e04e38 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1259,16 +1259,18 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) | |||
| 1259 | { | 1259 | { |
| 1260 | struct it it; | 1260 | struct it it; |
| 1261 | struct text_pos top; | 1261 | struct text_pos top; |
| 1262 | int visible_p; | 1262 | int visible_p = 0; |
| 1263 | struct buffer *old_buffer = NULL; | 1263 | struct buffer *old_buffer = NULL; |
| 1264 | 1264 | ||
| 1265 | if (noninteractive) | ||
| 1266 | return visible_p; | ||
| 1267 | |||
| 1265 | if (XBUFFER (w->buffer) != current_buffer) | 1268 | if (XBUFFER (w->buffer) != current_buffer) |
| 1266 | { | 1269 | { |
| 1267 | old_buffer = current_buffer; | 1270 | old_buffer = current_buffer; |
| 1268 | set_buffer_internal_1 (XBUFFER (w->buffer)); | 1271 | set_buffer_internal_1 (XBUFFER (w->buffer)); |
| 1269 | } | 1272 | } |
| 1270 | 1273 | ||
| 1271 | visible_p = 0; | ||
| 1272 | SET_TEXT_POS_FROM_MARKER (top, w->start); | 1274 | SET_TEXT_POS_FROM_MARKER (top, w->start); |
| 1273 | 1275 | ||
| 1274 | /* Compute exact mode line heights, if requested. */ | 1276 | /* Compute exact mode line heights, if requested. */ |
| @@ -1293,7 +1295,7 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) | |||
| 1293 | if (IT_CHARPOS (it) >= charpos) | 1295 | if (IT_CHARPOS (it) >= charpos) |
| 1294 | { | 1296 | { |
| 1295 | int top_y = it.current_y; | 1297 | int top_y = it.current_y; |
| 1296 | int bottom_y = line_bottom_y (&it); | 1298 | int bottom_y = (last_height = 0, line_bottom_y (&it)); |
| 1297 | int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); | 1299 | int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); |
| 1298 | 1300 | ||
| 1299 | if (top_y < window_top_y) | 1301 | if (top_y < window_top_y) |
| @@ -1303,7 +1305,7 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) | |||
| 1303 | if (visible_p && x) | 1305 | if (visible_p && x) |
| 1304 | { | 1306 | { |
| 1305 | *x = it.current_x; | 1307 | *x = it.current_x; |
| 1306 | *y = max (top_y + it.max_ascent - it.ascent, window_top_y); | 1308 | *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y); |
| 1307 | if (rtop) | 1309 | if (rtop) |
| 1308 | { | 1310 | { |
| 1309 | *rtop = max (0, window_top_y - top_y); | 1311 | *rtop = max (0, window_top_y - top_y); |
| @@ -1787,6 +1789,24 @@ get_glyph_string_clip_rect (s, nr) | |||
| 1787 | r.height = s->row->visible_height; | 1789 | r.height = s->row->visible_height; |
| 1788 | } | 1790 | } |
| 1789 | 1791 | ||
| 1792 | if (s->clip_head) | ||
| 1793 | if (r.x < s->clip_head->x) | ||
| 1794 | { | ||
| 1795 | if (r.width >= s->clip_head->x - r.x) | ||
| 1796 | r.width -= s->clip_head->x - r.x; | ||
| 1797 | else | ||
| 1798 | r.width = 0; | ||
| 1799 | r.x = s->clip_head->x; | ||
| 1800 | } | ||
| 1801 | if (s->clip_tail) | ||
| 1802 | if (r.x + r.width > s->clip_tail->x + s->clip_tail->background_width) | ||
| 1803 | { | ||
| 1804 | if (s->clip_tail->x + s->clip_tail->background_width >= r.x) | ||
| 1805 | r.width = s->clip_tail->x + s->clip_tail->background_width - r.x; | ||
| 1806 | else | ||
| 1807 | r.width = 0; | ||
| 1808 | } | ||
| 1809 | |||
| 1790 | /* If S draws overlapping rows, it's sufficient to use the top and | 1810 | /* If S draws overlapping rows, it's sufficient to use the top and |
| 1791 | bottom of the window for clipping because this glyph string | 1811 | bottom of the window for clipping because this glyph string |
| 1792 | intentionally draws over other lines. */ | 1812 | intentionally draws over other lines. */ |
| @@ -6505,11 +6525,15 @@ move_it_by_lines (it, dvpos, need_y_p) | |||
| 6505 | it->current_y -= it2.current_y; | 6525 | it->current_y -= it2.current_y; |
| 6506 | it->current_x = it->hpos = 0; | 6526 | it->current_x = it->hpos = 0; |
| 6507 | 6527 | ||
| 6508 | /* If we moved too far, move IT some lines forward. */ | 6528 | /* If we moved too far back, move IT some lines forward. */ |
| 6509 | if (it2.vpos > -dvpos) | 6529 | if (it2.vpos > -dvpos) |
| 6510 | { | 6530 | { |
| 6511 | int delta = it2.vpos + dvpos; | 6531 | int delta = it2.vpos + dvpos; |
| 6532 | it2 = *it; | ||
| 6512 | move_it_to (it, -1, -1, -1, it->vpos + delta, MOVE_TO_VPOS); | 6533 | move_it_to (it, -1, -1, -1, it->vpos + delta, MOVE_TO_VPOS); |
| 6534 | /* Move back again if we got too far ahead. */ | ||
| 6535 | if (IT_CHARPOS (*it) >= start_charpos) | ||
| 6536 | *it = it2; | ||
| 6513 | } | 6537 | } |
| 6514 | } | 6538 | } |
| 6515 | } | 6539 | } |
| @@ -12332,6 +12356,8 @@ redisplay_window (window, just_this_one_p) | |||
| 12332 | /* If centering point failed to make the whole line visible, | 12356 | /* If centering point failed to make the whole line visible, |
| 12333 | put point at the top instead. That has to make the whole line | 12357 | put point at the top instead. That has to make the whole line |
| 12334 | visible, if it can be done. */ | 12358 | visible, if it can be done. */ |
| 12359 | if (centering_position == 0) | ||
| 12360 | goto done; | ||
| 12335 | clear_glyph_matrix (w->desired_matrix); | 12361 | clear_glyph_matrix (w->desired_matrix); |
| 12336 | centering_position = 0; | 12362 | centering_position = 0; |
| 12337 | goto point_at_top; | 12363 | goto point_at_top; |
| @@ -18338,6 +18364,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | |||
| 18338 | { | 18364 | { |
| 18339 | struct glyph_string *head, *tail; | 18365 | struct glyph_string *head, *tail; |
| 18340 | struct glyph_string *s; | 18366 | struct glyph_string *s; |
| 18367 | struct glyph_string *clip_head = NULL, *clip_tail = NULL; | ||
| 18341 | int last_x, area_width; | 18368 | int last_x, area_width; |
| 18342 | int x_reached; | 18369 | int x_reached; |
| 18343 | int i, j; | 18370 | int i, j; |
| @@ -18406,6 +18433,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | |||
| 18406 | start = i; | 18433 | start = i; |
| 18407 | compute_overhangs_and_x (t, head->x, 1); | 18434 | compute_overhangs_and_x (t, head->x, 1); |
| 18408 | prepend_glyph_string_lists (&head, &tail, h, t); | 18435 | prepend_glyph_string_lists (&head, &tail, h, t); |
| 18436 | clip_head = head; | ||
| 18409 | } | 18437 | } |
| 18410 | 18438 | ||
| 18411 | /* Prepend glyph strings for glyphs in front of the first glyph | 18439 | /* Prepend glyph strings for glyphs in front of the first glyph |
| @@ -18418,6 +18446,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | |||
| 18418 | i = left_overwriting (head); | 18446 | i = left_overwriting (head); |
| 18419 | if (i >= 0) | 18447 | if (i >= 0) |
| 18420 | { | 18448 | { |
| 18449 | clip_head = head; | ||
| 18421 | BUILD_GLYPH_STRINGS (i, start, h, t, | 18450 | BUILD_GLYPH_STRINGS (i, start, h, t, |
| 18422 | DRAW_NORMAL_TEXT, dummy_x, last_x); | 18451 | DRAW_NORMAL_TEXT, dummy_x, last_x); |
| 18423 | for (s = h; s; s = s->next) | 18452 | for (s = h; s; s = s->next) |
| @@ -18437,6 +18466,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | |||
| 18437 | DRAW_NORMAL_TEXT, x, last_x); | 18466 | DRAW_NORMAL_TEXT, x, last_x); |
| 18438 | compute_overhangs_and_x (h, tail->x + tail->width, 0); | 18467 | compute_overhangs_and_x (h, tail->x + tail->width, 0); |
| 18439 | append_glyph_string_lists (&head, &tail, h, t); | 18468 | append_glyph_string_lists (&head, &tail, h, t); |
| 18469 | clip_tail = tail; | ||
| 18440 | } | 18470 | } |
| 18441 | 18471 | ||
| 18442 | /* Append glyph strings for glyphs following the last glyph | 18472 | /* Append glyph strings for glyphs following the last glyph |
| @@ -18447,6 +18477,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | |||
| 18447 | i = right_overwriting (tail); | 18477 | i = right_overwriting (tail); |
| 18448 | if (i >= 0) | 18478 | if (i >= 0) |
| 18449 | { | 18479 | { |
| 18480 | clip_tail = tail; | ||
| 18450 | BUILD_GLYPH_STRINGS (end, i, h, t, | 18481 | BUILD_GLYPH_STRINGS (end, i, h, t, |
| 18451 | DRAW_NORMAL_TEXT, x, last_x); | 18482 | DRAW_NORMAL_TEXT, x, last_x); |
| 18452 | for (s = h; s; s = s->next) | 18483 | for (s = h; s; s = s->next) |
| @@ -18454,6 +18485,12 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | |||
| 18454 | compute_overhangs_and_x (h, tail->x + tail->width, 0); | 18485 | compute_overhangs_and_x (h, tail->x + tail->width, 0); |
| 18455 | append_glyph_string_lists (&head, &tail, h, t); | 18486 | append_glyph_string_lists (&head, &tail, h, t); |
| 18456 | } | 18487 | } |
| 18488 | if (clip_head || clip_tail) | ||
| 18489 | for (s = head; s; s = s->next) | ||
| 18490 | { | ||
| 18491 | s->clip_head = clip_head; | ||
| 18492 | s->clip_tail = clip_tail; | ||
| 18493 | } | ||
| 18457 | } | 18494 | } |
| 18458 | 18495 | ||
| 18459 | /* Draw all strings. */ | 18496 | /* Draw all strings. */ |
| @@ -18467,8 +18504,9 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | |||
| 18467 | completely. */ | 18504 | completely. */ |
| 18468 | && !overlaps_p) | 18505 | && !overlaps_p) |
| 18469 | { | 18506 | { |
| 18470 | int x0 = head ? head->x : x; | 18507 | int x0 = clip_head ? clip_head->x : (head ? head->x : x); |
| 18471 | int x1 = tail ? tail->x + tail->background_width : x; | 18508 | int x1 = (clip_tail ? clip_tail->x + clip_tail->background_width |
| 18509 | : (tail ? tail->x + tail->background_width : x)); | ||
| 18472 | 18510 | ||
| 18473 | int text_left = window_box_left (w, TEXT_AREA); | 18511 | int text_left = window_box_left (w, TEXT_AREA); |
| 18474 | x0 -= text_left; | 18512 | x0 -= text_left; |