comparison src/xterm.c @ 109780:300a489dd304

Fix cursor drawing on stretch glyphs in R2L lines. xterm.c (x_draw_stretch_glyph_string): w32term.c (x_draw_stretch_glyph_string): In R2L rows, display the cursor on the right edge of the stretch glyph. xdisp.c (window_box_right_offset, window_box_right): Fix commentary.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 14 Aug 2010 15:55:04 +0300
parents e2f8226efb99
children 1ada063020ba
comparison
equal deleted inserted replaced
109779:d2d95919c4db 109780:300a489dd304
2433 xassert (s->first_glyph->type == STRETCH_GLYPH); 2433 xassert (s->first_glyph->type == STRETCH_GLYPH);
2434 2434
2435 if (s->hl == DRAW_CURSOR 2435 if (s->hl == DRAW_CURSOR
2436 && !x_stretch_cursor_p) 2436 && !x_stretch_cursor_p)
2437 { 2437 {
2438 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor 2438 /* If `x-stretch-cursor' is nil, don't draw a block cursor as
2439 as wide as the stretch glyph. */ 2439 wide as the stretch glyph. */
2440 int width, background_width = s->background_width; 2440 int width, background_width = s->background_width;
2441 int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); 2441 int x = s->x;
2442 2442
2443 if (x < left_x) 2443 if (!s->row->reversed_p)
2444 { 2444 {
2445 background_width -= left_x - x; 2445 int left_x = window_box_left_offset (s->w, TEXT_AREA);
2446 x = left_x; 2446
2447 if (x < left_x)
2448 {
2449 background_width -= left_x - x;
2450 x = left_x;
2451 }
2452 }
2453 else
2454 {
2455 /* In R2L rows, draw the cursor on the right edge of the
2456 stretch glyph. */
2457 int right_x = window_box_right_offset (s->w, TEXT_AREA);
2458
2459 if (x + background_width > right_x)
2460 background_width -= x - right_x;
2461 x += background_width;
2447 } 2462 }
2448 width = min (FRAME_COLUMN_WIDTH (s->f), background_width); 2463 width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
2464 if (s->row->reversed_p)
2465 x -= width;
2449 2466
2450 /* Draw cursor. */ 2467 /* Draw cursor. */
2451 x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); 2468 x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
2452 2469
2453 /* Clear rest using the GC of the original non-cursor face. */ 2470 /* Clear rest using the GC of the original non-cursor face. */
2456 int y = s->y; 2473 int y = s->y;
2457 int w = background_width - width, h = s->height; 2474 int w = background_width - width, h = s->height;
2458 XRectangle r; 2475 XRectangle r;
2459 GC gc; 2476 GC gc;
2460 2477
2461 x += width; 2478 if (!s->row->reversed_p)
2479 x += width;
2480 else
2481 x = s->x;
2462 if (s->row->mouse_face_p 2482 if (s->row->mouse_face_p
2463 && cursor_in_mouse_face_p (s->w)) 2483 && cursor_in_mouse_face_p (s->w))
2464 { 2484 {
2465 x_set_mouse_face_gc (s); 2485 x_set_mouse_face_gc (s);
2466 gc = s->gc; 2486 gc = s->gc;