diff --git a/config.c b/config.c index e0c11916..2fca8bc0 100644 --- a/config.c +++ b/config.c @@ -2248,9 +2248,9 @@ void setup_config_box(struct controlbox *b, bool midsession, HELPCTX(appearance_cursor), conf_radiobutton_handler, I(CONF_cursor_type), - "Block", 'l', I(0), - "Underline", 'u', I(1), - "Vertical line", 'v', I(2)); + "Block", 'l', I(CURSOR_BLOCK), + "Underline", 'u', I(CURSOR_UNDERLINE), + "Vertical line", 'v', I(CURSOR_VERTICAL_LINE)); ctrl_checkbox(s, "Cursor blinks", 'b', HELPCTX(appearance_cursor), conf_checkbox_handler, I(CONF_blink_cur)); diff --git a/putty.h b/putty.h index ad9a9e08..16c4d503 100644 --- a/putty.h +++ b/putty.h @@ -508,6 +508,10 @@ enum { FQ_DEFAULT, FQ_ANTIALIASED, FQ_NONANTIALIASED, FQ_CLEARTYPE }; +enum { + CURSOR_BLOCK, CURSOR_UNDERLINE, CURSOR_VERTICAL_LINE +}; + enum { SER_PAR_NONE, SER_PAR_ODD, SER_PAR_EVEN, SER_PAR_MARK, SER_PAR_SPACE }; diff --git a/unix/window.c b/unix/window.c index 103036b1..45df2213 100644 --- a/unix/window.c +++ b/unix/window.c @@ -4075,7 +4075,7 @@ static void gtkwin_draw_cursor( passive = true; } else passive = false; - if ((attr & TATTR_ACTCURS) && inst->cursor_type != 0) { + if ((attr & TATTR_ACTCURS) && inst->cursor_type != CURSOR_BLOCK) { attr &= ~TATTR_ACTCURS; active = true; } else @@ -4100,7 +4100,7 @@ static void gtkwin_draw_cursor( len *= 2; } - if (inst->cursor_type == 0) { + if (inst->cursor_type == CURSOR_BLOCK) { /* * An active block cursor will already have been done by * the above do_text call, so we only need to do anything @@ -4125,7 +4125,7 @@ static void gtkwin_draw_cursor( else char_width = inst->font_width; - if (inst->cursor_type == 1) { + if (inst->cursor_type == CURSOR_UNDERLINE) { uheight = inst->fonts[0]->ascent + 1; if (uheight >= inst->font_height) uheight = inst->font_height - 1; @@ -4135,7 +4135,7 @@ static void gtkwin_draw_cursor( dx = 1; dy = 0; length = len * widefactor * char_width; - } else { + } else /* inst->cursor_type == CURSOR_VERTICAL_LINE */ { int xadjust = 0; if (attr & TATTR_RIGHTCURS) xadjust = char_width - 1; diff --git a/windows/window.c b/windows/window.c index fb1ec9fa..0d1d10d3 100644 --- a/windows/window.c +++ b/windows/window.c @@ -3576,7 +3576,7 @@ static void do_text_internal( y += wgs->offset_height; if ((attr & TATTR_ACTCURS) && - (wgs->cursor_type == 0 || wgs->term->big_cursor)) { + (wgs->cursor_type == CURSOR_BLOCK || wgs->term->big_cursor)) { truecolour.fg = truecolour.bg = optionalrgb_none; attr &= ~(ATTR_REVERSE|ATTR_BLINK|ATTR_COLOURS|ATTR_DIM); /* cursor fg and bg */ @@ -3971,12 +3971,13 @@ static void wintw_draw_cursor( lattr &= LATTR_MODE; - if ((attr & TATTR_ACTCURS) && (ctype == 0 || wgs->term->big_cursor)) { + if ((attr & TATTR_ACTCURS) && + (ctype == CURSOR_BLOCK || wgs->term->big_cursor)) { if (*text != UCSWIDE) { win_draw_text(tw, x, y, text, len, attr, lattr, truecolour); return; } - ctype = 2; + ctype = CURSOR_VERTICAL_LINE; attr |= TATTR_RIGHTCURS; } @@ -3988,7 +3989,8 @@ static void wintw_draw_cursor( x += wgs->offset_width; y += wgs->offset_height; - if ((attr & TATTR_PASCURS) && (ctype == 0 || wgs->term->big_cursor)) { + if ((attr & TATTR_PASCURS) && + (ctype == CURSOR_BLOCK || wgs->term->big_cursor)) { POINT pts[5]; HPEN oldpen; pts[0].x = pts[1].x = pts[4].x = x; @@ -4000,15 +4002,16 @@ static void wintw_draw_cursor( Polyline(wgs->wintw_hdc, pts, 5); oldpen = SelectObject(wgs->wintw_hdc, oldpen); DeleteObject(oldpen); - } else if ((attr & (TATTR_ACTCURS | TATTR_PASCURS)) && ctype != 0) { + } else if ((attr & (TATTR_ACTCURS | TATTR_PASCURS)) && + ctype != CURSOR_BLOCK) { int startx, starty, dx, dy, length, i; - if (ctype == 1) { + if (ctype == CURSOR_UNDERLINE) { startx = x; starty = y + wgs->descent; dx = 1; dy = 0; length = char_width; - } else { + } else /* ctype == CURSOR_VERTICAL_LINE */ { int xadjust = 0; if (attr & TATTR_RIGHTCURS) xadjust = char_width - 1;