aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-09-25 10:12:53 +0000
committerGerd Moellmann2001-09-25 10:12:53 +0000
commit9f8531e59a243a2b8f459216d751975020e54c1d (patch)
tree1ff843de0b9324aea42b971673f600a65083e19f /src
parent65ace4c2ac12371d885c621376f49c3fe93776e9 (diff)
downloademacs-9f8531e59a243a2b8f459216d751975020e54c1d.tar.gz
emacs-9f8531e59a243a2b8f459216d751975020e54c1d.zip
(fast_find_position) [0]: Add a presumably more correct
version for after 21.1.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/xterm.c81
2 files changed, 83 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f4bdfbe7303..c54824eacbf 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
12001-09-25 Gerd Moellmann <gerd@gnu.org> 12001-09-25 Gerd Moellmann <gerd@gnu.org>
2 2
3 * xterm.c (fast_find_position) [0]: Add a presumably more correct
4 version for after 21.1.
5
6 * xdisp.c (row_containing_pos): Make externally visible.
7
8 * dispextern.h (row_containing_pos): Add prototype.
9
3 * process.c (send_process): Disable composition if from_byte < 0. 10 * process.c (send_process): Disable composition if from_byte < 0.
4 From Kenichi Handa <handa@etl.go.jp>. 11 From Kenichi Handa <handa@etl.go.jp>.
5 12
diff --git a/src/xterm.c b/src/xterm.c
index 2d56ae1c60f..2c3471509d7 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7493,13 +7493,82 @@ note_tool_bar_highlight (f, x, y)
7493 7493
7494 7494
7495 7495
7496/* Find the glyph matrix position of buffer position POS in window W. 7496/* Find the glyph matrix position of buffer position CHARPOS in window
7497 *HPOS, *VPOS, *X, and *Y are set to the positions found. W's 7497 *W. HPOS, *VPOS, *X, and *Y are set to the positions found. W's
7498 current glyphs must be up to date. If POS is above window start 7498 current glyphs must be up to date. If CHARPOS is above window
7499 return (0, 0, 0, 0). If POS is after end of W, return end of 7499 start return (0, 0, 0, 0). If CHARPOS is after end of W, return end
7500 last line in W. In the row containing POS, stop before glyphs 7500 of last line in W. In the row containing CHARPOS, stop before glyphs
7501 having STOP as object. */ 7501 having STOP as object. */
7502 7502
7503#if 0 /* This is a version of fast_find_position that's more correct
7504 in the presence of hscrolling, for example. I didn't install
7505 it right away because the problem fixed is minor, it failed
7506 in 20.x as well, and I think it's too risky to install
7507 so near the release of 21.1. 2001-09-25 gerd. */
7508
7509static int
7510fast_find_position (w, charpos, hpos, vpos, x, y, stop)
7511 struct window *w;
7512 int charpos;
7513 int *hpos, *vpos, *x, *y;
7514 Lisp_Object stop;
7515{
7516 struct glyph_row *row, *first;
7517 struct glyph *glyph, *end;
7518 int i, past_end = 0;
7519
7520 first = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
7521 row = row_containing_pos (w, charpos, first, NULL);
7522 if (row == NULL)
7523 {
7524 if (charpos < MATRIX_ROW_START_CHARPOS (first))
7525 {
7526 *x = *y = *hpos = *vpos = 0;
7527 return 0;
7528 }
7529 else
7530 {
7531 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
7532 past_end = 1;
7533 }
7534 }
7535
7536 *x = row->x;
7537 *y = row->y;
7538 *vpos = MATRIX_ROW_VPOS (row, w->current_matrix);
7539
7540 glyph = row->glyphs[TEXT_AREA];
7541 end = glyph + row->used[TEXT_AREA];
7542
7543 /* Skip over glyphs not having an object at the start of the row.
7544 These are special glyphs like truncation marks on terminal
7545 frames. */
7546 if (row->displays_text_p)
7547 while (glyph < end
7548 && INTEGERP (glyph->object)
7549 && !EQ (stop, glyph->object)
7550 && glyph->charpos < 0)
7551 {
7552 *x += glyph->pixel_width;
7553 ++glyph;
7554 }
7555
7556 while (glyph < end
7557 && !INTEGERP (glyph->object)
7558 && !EQ (stop, glyph->object)
7559 && (!BUFFERP (glyph->object)
7560 || glyph->charpos < charpos))
7561 {
7562 *x += glyph->pixel_width;
7563 ++glyph;
7564 }
7565
7566 *hpos = glyph - row->glyphs[TEXT_AREA];
7567 return past_end;
7568}
7569
7570#else /* not 0 */
7571
7503static int 7572static int
7504fast_find_position (w, pos, hpos, vpos, x, y, stop) 7573fast_find_position (w, pos, hpos, vpos, x, y, stop)
7505 struct window *w; 7574 struct window *w;
@@ -7596,6 +7665,8 @@ fast_find_position (w, pos, hpos, vpos, x, y, stop)
7596 return 0; 7665 return 0;
7597} 7666}
7598 7667
7668#endif /* not 0 */
7669
7599 7670
7600/* Find the position of the the glyph for position POS in OBJECT in 7671/* Find the position of the the glyph for position POS in OBJECT in
7601 window W's current matrix, and return in *X/*Y the pixel 7672 window W's current matrix, and return in *X/*Y the pixel