aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 009f01565d1..13ebd31e83e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1912,6 +1912,9 @@ note_mouse_movement (frame, event)
1912 } 1912 }
1913} 1913}
1914 1914
1915/* This is used for debugging, to turn off note_mouse_highlight. */
1916static int disable_mouse_highlight;
1917
1915/* Take proper action when the mouse has moved to position X, Y on frame F 1918/* Take proper action when the mouse has moved to position X, Y on frame F
1916 as regards highlighting characters that have mouse-face properties. 1919 as regards highlighting characters that have mouse-face properties.
1917 Also dehighlighting chars where the mouse was before. */ 1920 Also dehighlighting chars where the mouse was before. */
@@ -1925,6 +1928,9 @@ note_mouse_highlight (f, x, y)
1925 Lisp_Object window; 1928 Lisp_Object window;
1926 struct window *w; 1929 struct window *w;
1927 1930
1931 if (disable_mouse_highlight)
1932 return;
1933
1928 mouse_face_mouse_x = x; 1934 mouse_face_mouse_x = x;
1929 mouse_face_mouse_y = y; 1935 mouse_face_mouse_y = y;
1930 mouse_face_mouse_frame = f; 1936 mouse_face_mouse_frame = f;
@@ -2059,7 +2065,10 @@ note_mouse_highlight (f, x, y)
2059 2065
2060/* Find the row and column of position POS in window WINDOW. 2066/* Find the row and column of position POS in window WINDOW.
2061 Store them in *COLUMNP and *ROWP. 2067 Store them in *COLUMNP and *ROWP.
2062 This assumes display in WINDOW is up to date. */ 2068 This assumes display in WINDOW is up to date.
2069 If POS is above start of WINDOW, return coords
2070 of start of first screen line.
2071 If POS is after end of WINDOW, return coords of end of last screen line. */
2063 2072
2064static int 2073static int
2065fast_find_position (window, pos, columnp, rowp) 2074fast_find_position (window, pos, columnp, rowp)
@@ -2076,6 +2085,7 @@ fast_find_position (window, pos, columnp, rowp)
2076 int height = XFASTINT (w->height) - ! MINI_WINDOW_P (w); 2085 int height = XFASTINT (w->height) - ! MINI_WINDOW_P (w);
2077 int width = window_internal_width (w); 2086 int width = window_internal_width (w);
2078 int *charstarts; 2087 int *charstarts;
2088 int lastcol;
2079 2089
2080 for (i = 0; 2090 for (i = 0;
2081 i < height; 2091 i < height;
@@ -2089,14 +2099,21 @@ fast_find_position (window, pos, columnp, rowp)
2089 } 2099 }
2090 2100
2091 charstarts = FRAME_CURRENT_GLYPHS (f)->charstarts[top + row]; 2101 charstarts = FRAME_CURRENT_GLYPHS (f)->charstarts[top + row];
2102 lastcol = left;
2092 for (i = 0; i < width; i++) 2103 for (i = 0; i < width; i++)
2093 if (charstarts[left + i] == pos) 2104 {
2094 { 2105 if (charstarts[left + i] == pos)
2095 *rowp = row + top; 2106 {
2096 *columnp = i + left; 2107 *rowp = row + top;
2097 return 1; 2108 *columnp = i + left;
2098 } 2109 return 1;
2110 }
2111 else if (charstarts[left + i] > pos)
2112 lastcol = left + i;
2113 }
2099 2114
2115 *rowp = row + top;
2116 *columnp = lastcol;
2100 return 0; 2117 return 0;
2101} 2118}
2102 2119