diff options
| author | Eli Zaretskii | 2014-09-16 18:53:36 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-09-16 18:53:36 +0300 |
| commit | 534f1f7cb6b25f05472d59b6b4757cb345f29b8d (patch) | |
| tree | 49780e6748f0b201c6bce106373188354f7e6754 /src | |
| parent | c20b4c2de5a8c5ef4ac0655d74dd28c002b7aad3 (diff) | |
| download | emacs-534f1f7cb6b25f05472d59b6b4757cb345f29b8d.tar.gz emacs-534f1f7cb6b25f05472d59b6b4757cb345f29b8d.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/w32term.c | 11 | ||||
| -rw-r--r-- | src/xterm.c | 18 |
3 files changed, 31 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 49ff8efc794..c86f6de1575 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2014-09-16 Eli Zaretskii <eliz@gnu.org> | 1 | 2014-09-16 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * xterm.c (x_draw_hollow_cursor, x_draw_bar_cursor): | ||
| 4 | * w32term.c (x_draw_hollow_cursor, x_draw_bar_cursor): In R2L | ||
| 5 | lines, draw the hollow-box and hbar cursors on the right side of | ||
| 6 | cursor-glyph. Thanks to martin rudalics <rudalics@gmx.at> for | ||
| 7 | testing on X. | ||
| 8 | |||
| 3 | * xterm.c (x_draw_stretch_glyph_string): | 9 | * xterm.c (x_draw_stretch_glyph_string): |
| 4 | * w32term.c (x_draw_stretch_glyph_string): Fix a thinko that | 10 | * w32term.c (x_draw_stretch_glyph_string): Fix a thinko that |
| 5 | caused the block cursor to disappear on a TAB in R2L lines in | 11 | caused the block cursor to disappear on a TAB in R2L lines in |
diff --git a/src/w32term.c b/src/w32term.c index e4813e9e02f..5f15798eeeb 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -5086,6 +5086,12 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row) | |||
| 5086 | /* Compute frame-relative coordinates for phys cursor. */ | 5086 | /* Compute frame-relative coordinates for phys cursor. */ |
| 5087 | get_phys_cursor_geometry (w, row, cursor_glyph, &left, &top, &h); | 5087 | get_phys_cursor_geometry (w, row, cursor_glyph, &left, &top, &h); |
| 5088 | rect.left = left; | 5088 | rect.left = left; |
| 5089 | /* When on R2L character, show cursor at the right edge of the | ||
| 5090 | glyph, unless the cursor box is as wide as the glyph or wider | ||
| 5091 | (the latter happens when x-stretch-cursor is non-nil). */ | ||
| 5092 | if ((cursor_glyph->resolved_level & 1) != 0 | ||
| 5093 | && cursor_glyph->pixel_width > w->phys_cursor_width) | ||
| 5094 | rect.left += cursor_glyph->pixel_width - w->phys_cursor_width; | ||
| 5089 | rect.top = top; | 5095 | rect.top = top; |
| 5090 | rect.bottom = rect.top + h; | 5096 | rect.bottom = rect.top + h; |
| 5091 | rect.right = rect.left + w->phys_cursor_width; | 5097 | rect.right = rect.left + w->phys_cursor_width; |
| @@ -5167,7 +5173,7 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, | |||
| 5167 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), | 5173 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
| 5168 | width, row->height); | 5174 | width, row->height); |
| 5169 | } | 5175 | } |
| 5170 | else | 5176 | else /* HBAR_CURSOR */ |
| 5171 | { | 5177 | { |
| 5172 | int dummy_x, dummy_y, dummy_h; | 5178 | int dummy_x, dummy_y, dummy_h; |
| 5173 | 5179 | ||
| @@ -5178,6 +5184,9 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, | |||
| 5178 | 5184 | ||
| 5179 | get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x, | 5185 | get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x, |
| 5180 | &dummy_y, &dummy_h); | 5186 | &dummy_y, &dummy_h); |
| 5187 | if ((cursor_glyph->resolved_level & 1) != 0 | ||
| 5188 | && cursor_glyph->pixel_width > w->phys_cursor_width) | ||
| 5189 | x += cursor_glyph->pixel_width - w->phys_cursor_width; | ||
| 5181 | w32_fill_area (f, hdc, cursor_color, x, | 5190 | w32_fill_area (f, hdc, cursor_color, x, |
| 5182 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + | 5191 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + |
| 5183 | row->height - width), | 5192 | row->height - width), |
diff --git a/src/xterm.c b/src/xterm.c index f426755e401..717df452569 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -7126,6 +7126,15 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row) | |||
| 7126 | GCForeground, &xgcv); | 7126 | GCForeground, &xgcv); |
| 7127 | gc = dpyinfo->scratch_cursor_gc; | 7127 | gc = dpyinfo->scratch_cursor_gc; |
| 7128 | 7128 | ||
| 7129 | /* When on R2L character, show cursor at the right edge of the | ||
| 7130 | glyph, unless the cursor box is as wide as the glyph or wider | ||
| 7131 | (the latter happens when x-stretch-cursor is non-nil). */ | ||
| 7132 | if ((cursor_glyph->resolved_level & 1) != 0 | ||
| 7133 | && cursor_glyph->pixel_width > w->phys_cursor_width) | ||
| 7134 | { | ||
| 7135 | x += cursor_glyph->pixel_width - w->phys_cursor_width; | ||
| 7136 | wd -= 1; | ||
| 7137 | } | ||
| 7129 | /* Set clipping, draw the rectangle, and reset clipping again. */ | 7138 | /* Set clipping, draw the rectangle, and reset clipping again. */ |
| 7130 | x_clip_to_row (w, row, TEXT_AREA, gc); | 7139 | x_clip_to_row (w, row, TEXT_AREA, gc); |
| 7131 | XDrawRectangle (dpy, FRAME_X_WINDOW (f), gc, x, y, wd, h - 1); | 7140 | 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 | |||
| 7211 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), | 7220 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
| 7212 | width, row->height); | 7221 | width, row->height); |
| 7213 | } | 7222 | } |
| 7214 | else | 7223 | else /* HBAR_CURSOR */ |
| 7215 | { | 7224 | { |
| 7216 | int dummy_x, dummy_y, dummy_h; | 7225 | int dummy_x, dummy_y, dummy_h; |
| 7226 | int x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | ||
| 7217 | 7227 | ||
| 7218 | if (width < 0) | 7228 | if (width < 0) |
| 7219 | width = row->height; | 7229 | width = row->height; |
| @@ -7223,8 +7233,10 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text | |||
| 7223 | get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x, | 7233 | get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x, |
| 7224 | &dummy_y, &dummy_h); | 7234 | &dummy_y, &dummy_h); |
| 7225 | 7235 | ||
| 7226 | XFillRectangle (dpy, window, gc, | 7236 | if ((cursor_glyph->resolved_level & 1) != 0 |
| 7227 | WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), | 7237 | && cursor_glyph->pixel_width > w->phys_cursor_width) |
| 7238 | x += cursor_glyph->pixel_width - w->phys_cursor_width; | ||
| 7239 | XFillRectangle (dpy, window, gc, x, | ||
| 7228 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + | 7240 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + |
| 7229 | row->height - width), | 7241 | row->height - width), |
| 7230 | w->phys_cursor_width, width); | 7242 | w->phys_cursor_width, width); |