aboutsummaryrefslogtreecommitdiffstats
path: root/src/xdisp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xdisp.c')
-rw-r--r--src/xdisp.c100
1 files changed, 79 insertions, 21 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 9b5b913938b..0cb34a2fef8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1995,15 +1995,15 @@ get_glyph_string_clip_rect (s, nr)
1995 Set w->phys_cursor_width to width of phys cursor. 1995 Set w->phys_cursor_width to width of phys cursor.
1996*/ 1996*/
1997 1997
1998int 1998void
1999get_phys_cursor_geometry (w, row, glyph, heightp) 1999get_phys_cursor_geometry (w, row, glyph, xp, yp, heightp)
2000 struct window *w; 2000 struct window *w;
2001 struct glyph_row *row; 2001 struct glyph_row *row;
2002 struct glyph *glyph; 2002 struct glyph *glyph;
2003 int *heightp; 2003 int *xp, *yp, *heightp;
2004{ 2004{
2005 struct frame *f = XFRAME (WINDOW_FRAME (w)); 2005 struct frame *f = XFRAME (WINDOW_FRAME (w));
2006 int y, wd, h, h0, y0; 2006 int x, y, wd, h, h0, y0;
2007 2007
2008 /* Compute the width of the rectangle to draw. If on a stretch 2008 /* Compute the width of the rectangle to draw. If on a stretch
2009 glyph, and `x-stretch-block-cursor' is nil, don't draw a 2009 glyph, and `x-stretch-block-cursor' is nil, don't draw a
@@ -2013,6 +2013,14 @@ get_phys_cursor_geometry (w, row, glyph, heightp)
2013#ifdef HAVE_NTGUI 2013#ifdef HAVE_NTGUI
2014 wd++; /* Why? */ 2014 wd++; /* Why? */
2015#endif 2015#endif
2016
2017 x = w->phys_cursor.x;
2018 if (x < 0)
2019 {
2020 wd += x;
2021 x = 0;
2022 }
2023
2016 if (glyph->type == STRETCH_GLYPH 2024 if (glyph->type == STRETCH_GLYPH
2017 && !x_stretch_cursor_p) 2025 && !x_stretch_cursor_p)
2018 wd = min (FRAME_COLUMN_WIDTH (f), wd); 2026 wd = min (FRAME_COLUMN_WIDTH (f), wd);
@@ -2042,8 +2050,9 @@ get_phys_cursor_geometry (w, row, glyph, heightp)
2042 } 2050 }
2043 } 2051 }
2044 2052
2053 *xp = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, x);
2054 *yp = WINDOW_TO_FRAME_PIXEL_Y (w, y);
2045 *heightp = h; 2055 *heightp = h;
2046 return WINDOW_TO_FRAME_PIXEL_Y (w, y);
2047} 2056}
2048 2057
2049/* 2058/*
@@ -6334,6 +6343,8 @@ next_element_from_composition (it)
6334 it->position = (STRINGP (it->string) 6343 it->position = (STRINGP (it->string)
6335 ? it->current.string_pos 6344 ? it->current.string_pos
6336 : it->current.pos); 6345 : it->current.pos);
6346 if (STRINGP (it->string))
6347 it->object = it->string;
6337 return 1; 6348 return 1;
6338} 6349}
6339 6350
@@ -9608,7 +9619,8 @@ display_tool_bar_line (it, height)
9608 9619
9609 while (it->current_x < max_x) 9620 while (it->current_x < max_x)
9610 { 9621 {
9611 int x_before, x, n_glyphs_before, i, nglyphs; 9622 int x, n_glyphs_before, i, nglyphs;
9623 struct it it_before;
9612 9624
9613 /* Get the next display element. */ 9625 /* Get the next display element. */
9614 if (!get_next_display_element (it)) 9626 if (!get_next_display_element (it))
@@ -9620,22 +9632,23 @@ display_tool_bar_line (it, height)
9620 } 9632 }
9621 9633
9622 /* Produce glyphs. */ 9634 /* Produce glyphs. */
9623 x_before = it->current_x; 9635 n_glyphs_before = row->used[TEXT_AREA];
9624 n_glyphs_before = it->glyph_row->used[TEXT_AREA]; 9636 it_before = *it;
9637
9625 PRODUCE_GLYPHS (it); 9638 PRODUCE_GLYPHS (it);
9626 9639
9627 nglyphs = it->glyph_row->used[TEXT_AREA] - n_glyphs_before; 9640 nglyphs = row->used[TEXT_AREA] - n_glyphs_before;
9628 i = 0; 9641 i = 0;
9629 x = x_before; 9642 x = it_before.current_x;
9630 while (i < nglyphs) 9643 while (i < nglyphs)
9631 { 9644 {
9632 struct glyph *glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i; 9645 struct glyph *glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i;
9633 9646
9634 if (x + glyph->pixel_width > max_x) 9647 if (x + glyph->pixel_width > max_x)
9635 { 9648 {
9636 /* Glyph doesn't fit on line. */ 9649 /* Glyph doesn't fit on line. Backtrack. */
9637 it->glyph_row->used[TEXT_AREA] = n_glyphs_before + i; 9650 row->used[TEXT_AREA] = n_glyphs_before;
9638 it->current_x = x; 9651 *it = it_before;
9639 goto out; 9652 goto out;
9640 } 9653 }
9641 9654
@@ -9666,6 +9679,8 @@ display_tool_bar_line (it, height)
9666 /* Make line the desired height and center it vertically. */ 9679 /* Make line the desired height and center it vertically. */
9667 if ((height -= it->max_ascent + it->max_descent) > 0) 9680 if ((height -= it->max_ascent + it->max_descent) > 0)
9668 { 9681 {
9682 /* Don't add more than one line height. */
9683 height %= FRAME_LINE_HEIGHT (it->f);
9669 it->max_ascent += height / 2; 9684 it->max_ascent += height / 2;
9670 it->max_descent += (height + 1) / 2; 9685 it->max_descent += (height + 1) / 2;
9671 } 9686 }
@@ -11713,9 +11728,11 @@ redisplay_window_1 (window)
11713 11728
11714/* Set cursor position of W. PT is assumed to be displayed in ROW. 11729/* Set cursor position of W. PT is assumed to be displayed in ROW.
11715 DELTA is the number of bytes by which positions recorded in ROW 11730 DELTA is the number of bytes by which positions recorded in ROW
11716 differ from current buffer positions. */ 11731 differ from current buffer positions.
11717 11732
11718void 11733 Return 0 if cursor is not on this row. 1 otherwise. */
11734
11735int
11719set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) 11736set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
11720 struct window *w; 11737 struct window *w;
11721 struct glyph_row *row; 11738 struct glyph_row *row;
@@ -11865,6 +11882,11 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
11865 SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); 11882 SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string));
11866 } 11883 }
11867 } 11884 }
11885
11886 /* If we reached the end of the line, and end was from a string,
11887 cursor is not on this line. */
11888 if (glyph == end && row->continued_p)
11889 return 0;
11868 } 11890 }
11869 11891
11870 w->cursor.hpos = glyph - row->glyphs[TEXT_AREA]; 11892 w->cursor.hpos = glyph - row->glyphs[TEXT_AREA];
@@ -11898,6 +11920,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
11898 else 11920 else
11899 CHARPOS (this_line_start_pos) = 0; 11921 CHARPOS (this_line_start_pos) = 0;
11900 } 11922 }
11923
11924 return 1;
11901} 11925}
11902 11926
11903 11927
@@ -12581,8 +12605,18 @@ try_cursor_movement (window, startp, scroll_step)
12581 rc = CURSOR_MOVEMENT_MUST_SCROLL; 12605 rc = CURSOR_MOVEMENT_MUST_SCROLL;
12582 else 12606 else
12583 { 12607 {
12584 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); 12608 do
12585 rc = CURSOR_MOVEMENT_SUCCESS; 12609 {
12610 if (set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0))
12611 {
12612 rc = CURSOR_MOVEMENT_SUCCESS;
12613 break;
12614 }
12615 ++row;
12616 }
12617 while (MATRIX_ROW_BOTTOM_Y (row) < last_y
12618 && MATRIX_ROW_START_CHARPOS (row) == PT
12619 && cursor_row_p (w, row));
12586 } 12620 }
12587 } 12621 }
12588 } 12622 }
@@ -15035,6 +15069,25 @@ dump_glyph (row, glyph, area)
15035 glyph->left_box_line_p, 15069 glyph->left_box_line_p,
15036 glyph->right_box_line_p); 15070 glyph->right_box_line_p);
15037 } 15071 }
15072 else if (glyph->type == COMPOSITE_GLYPH)
15073 {
15074 fprintf (stderr,
15075 " %5d %4c %6d %c %3d 0x%05x %c %4d %1.1d%1.1d\n",
15076 glyph - row->glyphs[TEXT_AREA],
15077 '+',
15078 glyph->charpos,
15079 (BUFFERP (glyph->object)
15080 ? 'B'
15081 : (STRINGP (glyph->object)
15082 ? 'S'
15083 : '-')),
15084 glyph->pixel_width,
15085 glyph->u.cmp_id,
15086 '.',
15087 glyph->face_id,
15088 glyph->left_box_line_p,
15089 glyph->right_box_line_p);
15090 }
15038} 15091}
15039 15092
15040 15093
@@ -21603,7 +21656,7 @@ erase_phys_cursor (w)
21603 /* Maybe clear the display under the cursor. */ 21656 /* Maybe clear the display under the cursor. */
21604 if (w->phys_cursor_type == HOLLOW_BOX_CURSOR) 21657 if (w->phys_cursor_type == HOLLOW_BOX_CURSOR)
21605 { 21658 {
21606 int x, y; 21659 int x, y, left_x;
21607 int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); 21660 int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
21608 int width; 21661 int width;
21609 21662
@@ -21611,11 +21664,16 @@ erase_phys_cursor (w)
21611 if (cursor_glyph == NULL) 21664 if (cursor_glyph == NULL)
21612 goto mark_cursor_off; 21665 goto mark_cursor_off;
21613 21666
21614 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 21667 width = cursor_glyph->pixel_width;
21668 left_x = window_box_left_offset (w, TEXT_AREA);
21669 x = w->phys_cursor.x;
21670 if (x < left_x)
21671 width -= left_x - x;
21672 width = min (width, window_box_width (w, TEXT_AREA) - x);
21615 y = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, cursor_row->y)); 21673 y = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, cursor_row->y));
21616 width = min (cursor_glyph->pixel_width, 21674 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, max (x, left_x));
21617 window_box_width (w, TEXT_AREA) - w->phys_cursor.x);
21618 21675
21676 if (width > 0)
21619 rif->clear_frame_area (f, x, y, width, cursor_row->visible_height); 21677 rif->clear_frame_area (f, x, y, width, cursor_row->visible_height);
21620 } 21678 }
21621 21679