Commit 534f1f7c authored by Eli Zaretskii's avatar Eli Zaretskii

Fix display of hollow-box and hbar cursors on r2L lines.

 src/xterm.c (x_draw_hollow_cursor, x_draw_bar_cursor):
 src/w32term.c (x_draw_hollow_cursor, x_draw_bar_cursor): In R2L
 lines, draw the hollow-box and hbar cursors on the right side of
 cursor-glyph.  Thanks to Martin Rudalics <rudalics@gmx.at> for
 testing on X.
parent c20b4c2d
2014-09-16 Eli Zaretskii <eliz@gnu.org>
* xterm.c (x_draw_hollow_cursor, x_draw_bar_cursor):
* w32term.c (x_draw_hollow_cursor, x_draw_bar_cursor): In R2L
lines, draw the hollow-box and hbar cursors on the right side of
cursor-glyph. Thanks to martin rudalics <rudalics@gmx.at> for
testing on X.
* xterm.c (x_draw_stretch_glyph_string):
* w32term.c (x_draw_stretch_glyph_string): Fix a thinko that
caused the block cursor to disappear on a TAB in R2L lines in
......
......@@ -5086,6 +5086,12 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row)
/* Compute frame-relative coordinates for phys cursor. */
get_phys_cursor_geometry (w, row, cursor_glyph, &left, &top, &h);
rect.left = left;
/* When on R2L character, show cursor at the right edge of the
glyph, unless the cursor box is as wide as the glyph or wider
(the latter happens when x-stretch-cursor is non-nil). */
if ((cursor_glyph->resolved_level & 1) != 0
&& cursor_glyph->pixel_width > w->phys_cursor_width)
rect.left += cursor_glyph->pixel_width - w->phys_cursor_width;
rect.top = top;
rect.bottom = rect.top + h;
rect.right = rect.left + w->phys_cursor_width;
......@@ -5167,7 +5173,7 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row,
WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
width, row->height);
}
else
else /* HBAR_CURSOR */
{
int dummy_x, dummy_y, dummy_h;
......@@ -5178,6 +5184,9 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row,
get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x,
&dummy_y, &dummy_h);
if ((cursor_glyph->resolved_level & 1) != 0
&& cursor_glyph->pixel_width > w->phys_cursor_width)
x += cursor_glyph->pixel_width - w->phys_cursor_width;
w32_fill_area (f, hdc, cursor_color, x,
WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y +
row->height - width),
......
......@@ -7126,6 +7126,15 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row)
GCForeground, &xgcv);
gc = dpyinfo->scratch_cursor_gc;
/* When on R2L character, show cursor at the right edge of the
glyph, unless the cursor box is as wide as the glyph or wider
(the latter happens when x-stretch-cursor is non-nil). */
if ((cursor_glyph->resolved_level & 1) != 0
&& cursor_glyph->pixel_width > w->phys_cursor_width)
{
x += cursor_glyph->pixel_width - w->phys_cursor_width;
wd -= 1;
}
/* Set clipping, draw the rectangle, and reset clipping again. */
x_clip_to_row (w, row, TEXT_AREA, gc);
XDrawRectangle (dpy, FRAME_X_WINDOW (f), gc, x, y, wd, h - 1);
......@@ -7211,9 +7220,10 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text
WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
width, row->height);
}
else
else /* HBAR_CURSOR */
{
int dummy_x, dummy_y, dummy_h;
int x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
if (width < 0)
width = row->height;
......@@ -7223,8 +7233,10 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text
get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x,
&dummy_y, &dummy_h);
XFillRectangle (dpy, window, gc,
WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x),
if ((cursor_glyph->resolved_level & 1) != 0
&& cursor_glyph->pixel_width > w->phys_cursor_width)
x += cursor_glyph->pixel_width - w->phys_cursor_width;
XFillRectangle (dpy, window, gc, x,
WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y +
row->height - width),
w->phys_cursor_width, width);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment