diff options
author | Gerd Möllmann <gerd@gnu.org> | 2024-07-23 08:15:09 +0200 |
---|---|---|
committer | Gerd Möllmann <gerd@gnu.org> | 2024-07-23 08:15:09 +0200 |
commit | 2074e94c3b1800b795c11658f35fc30e74ecfb60 (patch) | |
tree | 83ed53129eb0761a7e545abc7be13d055a4c2b6c | |
parent | 1aaadc8aec5272d453b996ca4b4761f3da6a17db (diff) | |
download | emacs-2074e94c3b1800b795c11658f35fc30e74ecfb60.tar.gz emacs-2074e94c3b1800b795c11658f35fc30e74ecfb60.tar.bz2 emacs-2074e94c3b1800b795c11658f35fc30e74ecfb60.zip |
Fix disappearing bar cursor on Hebrew text (bug#72230)
* src/nsterm.m (ns_draw_window_cursor): Compute the correct bar cursor
rectangle for R2L before setting the clipping.
-rw-r--r-- | src/nsterm.m | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/nsterm.m b/src/nsterm.m index 794630de1c1..2aadada2df6 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -3026,7 +3026,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. -------------------------------------------------------------------------- */ { - NSRect r, s; + NSRect r; int fx, fy, h, cursor_height; struct frame *f = WINDOW_XFRAME (w); struct glyph *phys_cursor_glyph; @@ -3076,6 +3076,12 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, /* The bar cursor should never be wider than the glyph. */ if (cursor_width < w->phys_cursor_width) w->phys_cursor_width = cursor_width; + + /* If the character under cursor is R2L, draw the bar cursor + on the right of its glyph, rather than on the left. */ + cursor_glyph = get_phys_cursor_glyph (w); + if ((cursor_glyph->resolved_level & 1) != 0) + fx += cursor_glyph->pixel_width - w->phys_cursor_width; } /* If we have an HBAR, "cursor_width" MAY specify height. */ else if (cursor_type == HBAR_CURSOR) @@ -3126,18 +3132,8 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, [ctx restoreGraphicsState]; break; case HBAR_CURSOR: - NSRectFill (r); - [ctx restoreGraphicsState]; - break; case BAR_CURSOR: - s = r; - /* If the character under cursor is R2L, draw the bar cursor - on the right of its glyph, rather than on the left. */ - cursor_glyph = get_phys_cursor_glyph (w); - if ((cursor_glyph->resolved_level & 1) != 0) - s.origin.x += cursor_glyph->pixel_width - s.size.width; - - NSRectFill (s); + NSRectFill (r); [ctx restoreGraphicsState]; break; } |