1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-16 18:47:32 -05:00

Cleanup: make an enum for the values of CONF_cursor_type.

These have been magic numbers 0, 1 and 2 in the source for ages. I
think it's about time they had actual names, to make all the points of
use clearer.
This commit is contained in:
Simon Tatham
2023-05-29 15:51:17 +01:00
parent 8bd75b85ed
commit dfa91dfa8f
4 changed files with 21 additions and 14 deletions

View File

@ -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;