diff options
Diffstat (limited to 'src/nsterm.m')
| -rw-r--r-- | src/nsterm.m | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/nsterm.m b/src/nsterm.m index cc2c4cf9807..c7cd411c614 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -2235,7 +2235,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2235 | -------------------------------------------------------------------------- */ | 2235 | -------------------------------------------------------------------------- */ |
| 2236 | { | 2236 | { |
| 2237 | NSRect r, s; | 2237 | NSRect r, s; |
| 2238 | int fx, fy, h; | 2238 | int fx, fy, h, cursor_height; |
| 2239 | struct frame *f = WINDOW_XFRAME (w); | 2239 | struct frame *f = WINDOW_XFRAME (w); |
| 2240 | struct glyph *phys_cursor_glyph; | 2240 | struct glyph *phys_cursor_glyph; |
| 2241 | int overspill; | 2241 | int overspill; |
| @@ -2279,13 +2279,20 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2279 | get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h); | 2279 | get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h); |
| 2280 | 2280 | ||
| 2281 | /* The above get_phys_cursor_geometry call set w->phys_cursor_width | 2281 | /* The above get_phys_cursor_geometry call set w->phys_cursor_width |
| 2282 | to the glyph width; replace with CURSOR_WIDTH for bar cursors. */ | 2282 | to the glyph width; replace with CURSOR_WIDTH for (V)BAR cursors. */ |
| 2283 | if (cursor_type == BAR_CURSOR || cursor_type == HBAR_CURSOR) | 2283 | if (cursor_type == BAR_CURSOR) |
| 2284 | { | 2284 | { |
| 2285 | if (cursor_width < 1) | 2285 | if (cursor_width < 1) |
| 2286 | cursor_width = max (FRAME_CURSOR_WIDTH (f), 1); | 2286 | cursor_width = max (FRAME_CURSOR_WIDTH (f), 1); |
| 2287 | w->phys_cursor_width = cursor_width; | 2287 | w->phys_cursor_width = cursor_width; |
| 2288 | } | 2288 | } |
| 2289 | /* If we have an HBAR, "cursor_width" MAY specify height. */ | ||
| 2290 | else if (cursor_type == HBAR_CURSOR) | ||
| 2291 | { | ||
| 2292 | cursor_height = (cursor_width < 1) ? lrint (0.25 * h) : cursor_width; | ||
| 2293 | fy += h - cursor_height; | ||
| 2294 | h = cursor_height; | ||
| 2295 | } | ||
| 2289 | 2296 | ||
| 2290 | r.origin.x = fx, r.origin.y = fy; | 2297 | r.origin.x = fx, r.origin.y = fy; |
| 2291 | r.size.height = h; | 2298 | r.size.height = h; |
| @@ -2337,10 +2344,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2337 | [FRAME_CURSOR_COLOR (f) set]; | 2344 | [FRAME_CURSOR_COLOR (f) set]; |
| 2338 | break; | 2345 | break; |
| 2339 | case HBAR_CURSOR: | 2346 | case HBAR_CURSOR: |
| 2340 | s = r; | 2347 | NSRectFill (r); |
| 2341 | s.origin.y += lrint (0.75 * s.size.height); | ||
| 2342 | s.size.height = lrint (s.size.height * 0.25); | ||
| 2343 | NSRectFill (s); | ||
| 2344 | break; | 2348 | break; |
| 2345 | case BAR_CURSOR: | 2349 | case BAR_CURSOR: |
| 2346 | s = r; | 2350 | s = r; |