Fix cursor not being rendered on empty cells

This commit is contained in:
Kovid Goyal 2017-09-15 11:08:42 +05:30
parent 44c897a61a
commit f0a9f32d0a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -463,7 +463,7 @@ extern void cocoa_update_title(PyObject*);
static inline void static inline void
render_cursor(Window *w, double now) { render_cursor(Window *w, double now) {
ScreenRenderData *rd = &w->render_data; ScreenRenderData *rd = &w->render_data;
if (rd->screen->scrolled_by || ! screen_is_cursor_visible(rd->screen)) return; if (rd->screen->scrolled_by || !screen_is_cursor_visible(rd->screen)) return;
double time_since_start_blink = now - global_state.cursor_blink_zero_time; double time_since_start_blink = now - global_state.cursor_blink_zero_time;
bool cursor_blinking = OPT(cursor_blink_interval) > 0 && global_state.application_focused && time_since_start_blink <= OPT(cursor_stop_blinking_after) ? true : false; bool cursor_blinking = OPT(cursor_blink_interval) > 0 && global_state.application_focused && time_since_start_blink <= OPT(cursor_stop_blinking_after) ? true : false;
bool do_draw_cursor = true; bool do_draw_cursor = true;
@ -481,7 +481,7 @@ render_cursor(Window *w, double now) {
double left = rd->xstart + cursor->x * rd->dx; double left = rd->xstart + cursor->x * rd->dx;
double top = rd->ystart - cursor->y * rd->dy; double top = rd->ystart - cursor->y * rd->dy;
int shape = cursor->shape ? cursor->shape : OPT(cursor_shape); int shape = cursor->shape ? cursor->shape : OPT(cursor_shape);
unsigned long mult = screen_current_char_width(rd->screen); unsigned long mult = MAX(1, screen_current_char_width(rd->screen));
double right = left + (shape == CURSOR_BEAM ? cursor_width(1.5, true) : rd->dx * mult); double right = left + (shape == CURSOR_BEAM ? cursor_width(1.5, true) : rd->dx * mult);
double bottom = top - rd->dy; double bottom = top - rd->dy;
if (shape == CURSOR_UNDERLINE) top = bottom + cursor_width(2.0, false); if (shape == CURSOR_UNDERLINE) top = bottom + cursor_width(2.0, false);