aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-05-23 06:47:51 +0000
committerRichard M. Stallman1994-05-23 06:47:51 +0000
commit4d73d0388d03c94cca6335d0a352514756c6a8dc (patch)
treeac05153fcad23abbf61c3fb0a90ee9c604bd8bf2 /src
parent8aa034e1fbfe26de0d4d4f3eb21854d0e12f729f (diff)
downloademacs-4d73d0388d03c94cca6335d0a352514756c6a8dc.tar.gz
emacs-4d73d0388d03c94cca6335d0a352514756c6a8dc.zip
(x_set_window_size): If cursor outside new size, mark it off.
(note_mouse_highlight): Handle case of highlight extending past end of window. (fast_find_position): Fix bugs when no text on screen and when the mouse is on an empty line.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/xterm.c b/src/xterm.c
index dd8c0cf5446..528b250b32c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -284,6 +284,7 @@ static Time last_mouse_movement_time;
284 redraw anything on its account. */ 284 redraw anything on its account. */
285static int mouse_face_beg_row, mouse_face_beg_col; 285static int mouse_face_beg_row, mouse_face_beg_col;
286static int mouse_face_end_row, mouse_face_end_col; 286static int mouse_face_end_row, mouse_face_end_col;
287static int mouse_face_past_end;
287static Lisp_Object mouse_face_window; 288static Lisp_Object mouse_face_window;
288static int mouse_face_face_id; 289static int mouse_face_face_id;
289 290
@@ -2184,7 +2185,8 @@ note_mouse_highlight (f, x, y)
2184 && row >= mouse_face_beg_row 2185 && row >= mouse_face_beg_row
2185 && row <= mouse_face_end_row 2186 && row <= mouse_face_end_row
2186 && (row > mouse_face_beg_row || column >= mouse_face_beg_col) 2187 && (row > mouse_face_beg_row || column >= mouse_face_beg_col)
2187 && (row < mouse_face_end_row || column < mouse_face_end_col))) 2188 && (row < mouse_face_end_row || column < mouse_face_end_col
2189 || mouse_face_past_end)))
2188 { 2190 {
2189 Lisp_Object mouse_face, overlay, position; 2191 Lisp_Object mouse_face, overlay, position;
2190 Lisp_Object *overlay_vec; 2192 Lisp_Object *overlay_vec;
@@ -2246,10 +2248,11 @@ note_mouse_highlight (f, x, y)
2246 before = Foverlay_start (overlay); 2248 before = Foverlay_start (overlay);
2247 after = Foverlay_end (overlay); 2249 after = Foverlay_end (overlay);
2248 /* Record this as the current active region. */ 2250 /* Record this as the current active region. */
2249 fast_find_position (window, before, 2251 fast_find_position (window, before, &mouse_face_beg_col,
2250 &mouse_face_beg_col, &mouse_face_beg_row); 2252 &mouse_face_beg_row);
2251 fast_find_position (window, after, 2253 mouse_face_past_end
2252 &mouse_face_end_col, &mouse_face_end_row); 2254 = !fast_find_position (window, after, &mouse_face_end_col,
2255 &mouse_face_end_row);
2253 mouse_face_window = window; 2256 mouse_face_window = window;
2254 mouse_face_face_id = compute_char_face (f, w, pos, 0, 0, 2257 mouse_face_face_id = compute_char_face (f, w, pos, 0, 0,
2255 &ignore, pos + 1, 1); 2258 &ignore, pos + 1, 1);
@@ -2277,10 +2280,11 @@ note_mouse_highlight (f, x, y)
2277 = Fnext_single_property_change (position, Qmouse_face, 2280 = Fnext_single_property_change (position, Qmouse_face,
2278 w->buffer, end); 2281 w->buffer, end);
2279 /* Record this as the current active region. */ 2282 /* Record this as the current active region. */
2280 fast_find_position (window, before, 2283 fast_find_position (window, before, &mouse_face_beg_col,
2281 &mouse_face_beg_col, &mouse_face_beg_row); 2284 &mouse_face_beg_row);
2282 fast_find_position (window, after, 2285 mouse_face_past_end
2283 &mouse_face_end_col, &mouse_face_end_row); 2286 = !fast_find_position (window, after, &mouse_face_end_col,
2287 &mouse_face_end_row);
2284 mouse_face_window = window; 2288 mouse_face_window = window;
2285 mouse_face_face_id 2289 mouse_face_face_id
2286 = compute_char_face (f, w, pos, 0, 0, 2290 = compute_char_face (f, w, pos, 0, 0,
@@ -2301,7 +2305,9 @@ note_mouse_highlight (f, x, y)
2301 This assumes display in WINDOW is up to date. 2305 This assumes display in WINDOW is up to date.
2302 If POS is above start of WINDOW, return coords 2306 If POS is above start of WINDOW, return coords
2303 of start of first screen line. 2307 of start of first screen line.
2304 If POS is after end of WINDOW, return coords of end of last screen line. */ 2308 If POS is after end of WINDOW, return coords of end of last screen line.
2309
2310 Value is 1 if POS is in range, 0 if it was off screen. */
2305 2311
2306static int 2312static int
2307fast_find_position (window, pos, columnp, rowp) 2313fast_find_position (window, pos, columnp, rowp)
@@ -2312,7 +2318,7 @@ fast_find_position (window, pos, columnp, rowp)
2312 struct window *w = XWINDOW (window); 2318 struct window *w = XWINDOW (window);
2313 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); 2319 FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
2314 int i; 2320 int i;
2315 int row; 2321 int row = 0;
2316 int left = w->left; 2322 int left = w->left;
2317 int top = w->top; 2323 int top = w->top;
2318 int height = XFASTINT (w->height) - ! MINI_WINDOW_P (w); 2324 int height = XFASTINT (w->height) - ! MINI_WINDOW_P (w);
@@ -2320,6 +2326,7 @@ fast_find_position (window, pos, columnp, rowp)
2320 int *charstarts; 2326 int *charstarts;
2321 int lastcol; 2327 int lastcol;
2322 2328
2329 /* Find the right row. */
2323 for (i = 0; 2330 for (i = 0;
2324 i < height; 2331 i < height;
2325 i++) 2332 i++)
@@ -2331,6 +2338,7 @@ fast_find_position (window, pos, columnp, rowp)
2331 row = i; 2338 row = i;
2332 } 2339 }
2333 2340
2341 /* Find the right column with in it. */
2334 charstarts = FRAME_CURRENT_GLYPHS (f)->charstarts[top + row]; 2342 charstarts = FRAME_CURRENT_GLYPHS (f)->charstarts[top + row];
2335 lastcol = left; 2343 lastcol = left;
2336 for (i = 0; i < width; i++) 2344 for (i = 0; i < width; i++)
@@ -2342,6 +2350,8 @@ fast_find_position (window, pos, columnp, rowp)
2342 return 1; 2350 return 1;
2343 } 2351 }
2344 else if (charstarts[left + i] > pos) 2352 else if (charstarts[left + i] > pos)
2353 break;
2354 else if (charstarts[left + i] > 0)
2345 lastcol = left + i; 2355 lastcol = left + i;
2346 } 2356 }
2347 2357
@@ -5319,6 +5329,14 @@ x_set_window_size (f, change_gravity, cols, rows)
5319 PIXEL_WIDTH (f) = pixelwidth; 5329 PIXEL_WIDTH (f) = pixelwidth;
5320 PIXEL_HEIGHT (f) = pixelheight; 5330 PIXEL_HEIGHT (f) = pixelheight;
5321 5331
5332 /* If cursor was outside the new size, mark it as off. */
5333 if (f->phys_cursor_y >= rows
5334 || f->phys_cursor_x >= cols)
5335 {
5336 f->phys_cursor_x = -1;
5337 f->phys_cursor_y = -1;
5338 }
5339
5322 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to 5340 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to
5323 receive in the ConfigureNotify event; if we get what we asked 5341 receive in the ConfigureNotify event; if we get what we asked
5324 for, then the event won't cause the screen to become garbaged, so 5342 for, then the event won't cause the screen to become garbaged, so