diff options
| author | Karl Heuer | 1994-05-02 21:24:16 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-05-02 21:24:16 +0000 |
| commit | 3b50638621701488daada4d7779c4038ac3723cf (patch) | |
| tree | 9708b36569c3018ec26166ca905e3e3dd2d8e82f /src | |
| parent | 55836b737128188e5eb0e362ebb0f436579c39b4 (diff) | |
| download | emacs-3b50638621701488daada4d7779c4038ac3723cf.tar.gz emacs-3b50638621701488daada4d7779c4038ac3723cf.zip | |
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Use row/col instead of buffer position to keep track of highlighted area.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src/xterm.c b/src/xterm.c index 32e11dfaee5..d0e368817dc 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -276,7 +276,8 @@ static Time last_mouse_movement_time; | |||
| 276 | in its mouse-face, together with the window they apply to. | 276 | in its mouse-face, together with the window they apply to. |
| 277 | As long as the mouse stays within this range, we need not | 277 | As long as the mouse stays within this range, we need not |
| 278 | redraw anything on its account. */ | 278 | redraw anything on its account. */ |
| 279 | static int mouse_face_beg, mouse_face_end; | 279 | static int mouse_face_beg_row, mouse_face_beg_col; |
| 280 | static int mouse_face_end_row, mouse_face_end_col; | ||
| 280 | static Lisp_Object mouse_face_window; | 281 | static Lisp_Object mouse_face_window; |
| 281 | static int mouse_face_face_id; | 282 | static int mouse_face_face_id; |
| 282 | 283 | ||
| @@ -2174,7 +2175,10 @@ note_mouse_highlight (f, x, y) | |||
| 2174 | if (pos <= 0) | 2175 | if (pos <= 0) |
| 2175 | clear_mouse_face (); | 2176 | clear_mouse_face (); |
| 2176 | else if (! (EQ (window, mouse_face_window) | 2177 | else if (! (EQ (window, mouse_face_window) |
| 2177 | && pos >= mouse_face_beg && pos < mouse_face_end)) | 2178 | && row >= mouse_face_beg_row |
| 2179 | && row <= mouse_face_end_row | ||
| 2180 | && (row > mouse_face_beg_row || column >= mouse_face_beg_col) | ||
| 2181 | && (row < mouse_face_end_row || column < mouse_face_end_col))) | ||
| 2178 | { | 2182 | { |
| 2179 | Lisp_Object mouse_face, overlay, position; | 2183 | Lisp_Object mouse_face, overlay, position; |
| 2180 | Lisp_Object *overlay_vec; | 2184 | Lisp_Object *overlay_vec; |
| @@ -2236,8 +2240,10 @@ note_mouse_highlight (f, x, y) | |||
| 2236 | before = Foverlay_start (overlay); | 2240 | before = Foverlay_start (overlay); |
| 2237 | after = Foverlay_end (overlay); | 2241 | after = Foverlay_end (overlay); |
| 2238 | /* Record this as the current active region. */ | 2242 | /* Record this as the current active region. */ |
| 2239 | mouse_face_beg = XFASTINT (before); | 2243 | fast_find_position (window, before, |
| 2240 | mouse_face_end = XFASTINT (after); | 2244 | &mouse_face_beg_col, &mouse_face_beg_row); |
| 2245 | fast_find_position (window, after, | ||
| 2246 | &mouse_face_end_col, &mouse_face_end_row); | ||
| 2241 | mouse_face_window = window; | 2247 | mouse_face_window = window; |
| 2242 | mouse_face_face_id = compute_char_face (f, w, pos, 0, 0, | 2248 | mouse_face_face_id = compute_char_face (f, w, pos, 0, 0, |
| 2243 | &ignore, pos + 1, 1); | 2249 | &ignore, pos + 1, 1); |
| @@ -2265,8 +2271,10 @@ note_mouse_highlight (f, x, y) | |||
| 2265 | = Fnext_single_property_change (position, Qmouse_face, | 2271 | = Fnext_single_property_change (position, Qmouse_face, |
| 2266 | w->buffer, end); | 2272 | w->buffer, end); |
| 2267 | /* Record this as the current active region. */ | 2273 | /* Record this as the current active region. */ |
| 2268 | mouse_face_beg = XFASTINT (before); | 2274 | fast_find_position (window, before, |
| 2269 | mouse_face_end = XFASTINT (after); | 2275 | &mouse_face_beg_col, &mouse_face_beg_row); |
| 2276 | fast_find_position (window, after, | ||
| 2277 | &mouse_face_end_col, &mouse_face_end_row); | ||
| 2270 | mouse_face_window = window; | 2278 | mouse_face_window = window; |
| 2271 | mouse_face_face_id | 2279 | mouse_face_face_id |
| 2272 | = compute_char_face (f, w, pos, 0, 0, | 2280 | = compute_char_face (f, w, pos, 0, 0, |
| @@ -2343,7 +2351,6 @@ static void | |||
| 2343 | show_mouse_face (hl) | 2351 | show_mouse_face (hl) |
| 2344 | int hl; | 2352 | int hl; |
| 2345 | { | 2353 | { |
| 2346 | int begcol, begrow, endcol, endrow; | ||
| 2347 | struct window *w = XWINDOW (mouse_face_window); | 2354 | struct window *w = XWINDOW (mouse_face_window); |
| 2348 | int width = window_internal_width (w); | 2355 | int width = window_internal_width (w); |
| 2349 | FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); | 2356 | FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); |
| @@ -2352,21 +2359,16 @@ show_mouse_face (hl) | |||
| 2352 | int curs_y = f->phys_cursor_y; | 2359 | int curs_y = f->phys_cursor_y; |
| 2353 | int cursor_off = 0; | 2360 | int cursor_off = 0; |
| 2354 | 2361 | ||
| 2355 | fast_find_position (mouse_face_window, mouse_face_beg, | 2362 | for (i = mouse_face_beg_row; i <= mouse_face_end_row; i++) |
| 2356 | &begcol, &begrow); | ||
| 2357 | fast_find_position (mouse_face_window, mouse_face_end, | ||
| 2358 | &endcol, &endrow); | ||
| 2359 | |||
| 2360 | for (i = begrow; i <= endrow; i++) | ||
| 2361 | { | 2363 | { |
| 2362 | int column = (i == begrow ? begcol : w->left); | 2364 | int column = (i == mouse_face_beg_row ? mouse_face_beg_col : w->left); |
| 2363 | int endcolumn = (i == endrow ? endcol : w->left + width); | 2365 | int endcolumn = (i == mouse_face_end_row ? mouse_face_end_col : w->left + width); |
| 2364 | endcolumn = min (endcolumn, FRAME_CURRENT_GLYPHS (f)->used[i] - w->left); | 2366 | endcolumn = min (endcolumn, FRAME_CURRENT_GLYPHS (f)->used[i] - w->left); |
| 2365 | 2367 | ||
| 2366 | /* If the cursor's in the text we are about to rewrite, | 2368 | /* If the cursor's in the text we are about to rewrite, |
| 2367 | turn the cursor off. */ | 2369 | turn the cursor off. */ |
| 2368 | if (i == curs_y | 2370 | if (i == curs_y |
| 2369 | && (curs_x >= begcol - 1 && curs_x <= endcol)) | 2371 | && curs_x >= mouse_face_beg_col - 1 && curs_x <= mouse_face_end_col) |
| 2370 | { | 2372 | { |
| 2371 | x_display_cursor (f, 0); | 2373 | x_display_cursor (f, 0); |
| 2372 | cursor_off = 1; | 2374 | cursor_off = 1; |
| @@ -2401,8 +2403,8 @@ clear_mouse_face () | |||
| 2401 | if (! NILP (mouse_face_window)) | 2403 | if (! NILP (mouse_face_window)) |
| 2402 | show_mouse_face (0); | 2404 | show_mouse_face (0); |
| 2403 | 2405 | ||
| 2404 | mouse_face_beg = -1; | 2406 | mouse_face_beg_row = mouse_face_beg_col = -1; |
| 2405 | mouse_face_end = -1; | 2407 | mouse_face_end_row = mouse_face_end_col = -1; |
| 2406 | mouse_face_window = Qnil; | 2408 | mouse_face_window = Qnil; |
| 2407 | } | 2409 | } |
| 2408 | 2410 | ||
| @@ -5638,8 +5640,8 @@ x_destroy_window (f) | |||
| 5638 | 5640 | ||
| 5639 | if (f == mouse_face_mouse_frame) | 5641 | if (f == mouse_face_mouse_frame) |
| 5640 | { | 5642 | { |
| 5641 | mouse_face_beg = -1; | 5643 | mouse_face_beg_row = mouse_face_beg_col = -1; |
| 5642 | mouse_face_end = -1; | 5644 | mouse_face_end_row = mouse_face_end_col = -1; |
| 5643 | mouse_face_window = Qnil; | 5645 | mouse_face_window = Qnil; |
| 5644 | } | 5646 | } |
| 5645 | 5647 | ||