# HG changeset patch # User Richard M. Stallman # Date 765338644 0 # Node ID 8e2379ce4fcbc96f07d72f9a4c45ebc62f4c0454 # Parent 07be9ae289cec3b8ab680b0357cc4a060dcf2a2c (fast_find_position): Always return coords within the window. (note_mouse_highlight): Handle disable_mouse_highlight. diff -r 07be9ae289ce -r 8e2379ce4fcb src/xterm.c --- a/src/xterm.c Sun Apr 03 02:03:30 1994 +0000 +++ b/src/xterm.c Sun Apr 03 02:04:04 1994 +0000 @@ -1912,6 +1912,9 @@ } } +/* This is used for debugging, to turn off note_mouse_highlight. */ +static int disable_mouse_highlight; + /* Take proper action when the mouse has moved to position X, Y on frame F as regards highlighting characters that have mouse-face properties. Also dehighlighting chars where the mouse was before. */ @@ -1925,6 +1928,9 @@ Lisp_Object window; struct window *w; + if (disable_mouse_highlight) + return; + mouse_face_mouse_x = x; mouse_face_mouse_y = y; mouse_face_mouse_frame = f; @@ -2059,7 +2065,10 @@ /* Find the row and column of position POS in window WINDOW. Store them in *COLUMNP and *ROWP. - This assumes display in WINDOW is up to date. */ + This assumes display in WINDOW is up to date. + If POS is above start of WINDOW, return coords + of start of first screen line. + If POS is after end of WINDOW, return coords of end of last screen line. */ static int fast_find_position (window, pos, columnp, rowp) @@ -2076,6 +2085,7 @@ int height = XFASTINT (w->height) - ! MINI_WINDOW_P (w); int width = window_internal_width (w); int *charstarts; + int lastcol; for (i = 0; i < height; @@ -2089,14 +2099,21 @@ } charstarts = FRAME_CURRENT_GLYPHS (f)->charstarts[top + row]; + lastcol = left; for (i = 0; i < width; i++) - if (charstarts[left + i] == pos) - { - *rowp = row + top; - *columnp = i + left; - return 1; - } - + { + if (charstarts[left + i] == pos) + { + *rowp = row + top; + *columnp = i + left; + return 1; + } + else if (charstarts[left + i] > pos) + lastcol = left + i; + } + + *rowp = row + top; + *columnp = lastcol; return 0; }