1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Minor refactoring in terminal.c.

The actual calls to win_draw_{text,cursor} in do_paint() were
duplicated in two places, and I may want to change them soon, so it's
convenient to centralise them.
This commit is contained in:
Simon Tatham 2019-02-26 07:12:13 +00:00
parent fec93d5e05
commit 35f071f61c

View File

@ -5040,6 +5040,16 @@ static termchar *term_bidi_line(Terminal *term, struct termline *ldata,
return lchars; return lchars;
} }
static void do_paint_draw(Terminal *term, termline *ldata, int x, int y,
wchar_t *ch, int ccount,
unsigned long attr, truecolour tc)
{
win_draw_text(term->win, x, y, ch, ccount, attr, ldata->lattr, tc);
if (attr & (TATTR_ACTCURS | TATTR_PASCURS))
win_draw_cursor(term->win, x, y, ch, ccount,
attr, ldata->lattr, tc);
}
/* /*
* Given a context, update the window. * Given a context, update the window.
*/ */
@ -5344,13 +5354,8 @@ static void do_paint(Terminal *term)
} }
if (break_run) { if (break_run) {
if ((dirty_run || last_run_dirty) && ccount > 0) { if ((dirty_run || last_run_dirty) && ccount > 0)
win_draw_text(term->win, start, i, ch, ccount, do_paint_draw(term, ldata, start, i, ch, ccount, attr, tc);
attr, ldata->lattr, tc);
if (attr & (TATTR_ACTCURS | TATTR_PASCURS))
win_draw_cursor(term->win, start, i, ch, ccount, attr,
ldata->lattr, tc);
}
start = j; start = j;
ccount = 0; ccount = 0;
attr = tattr; attr = tattr;
@ -5444,13 +5449,8 @@ static void do_paint(Terminal *term)
} }
} }
} }
if (dirty_run && ccount > 0) { if (dirty_run && ccount > 0)
win_draw_text(term->win, start, i, ch, ccount, do_paint_draw(term, ldata, start, i, ch, ccount, attr, tc);
attr, ldata->lattr, tc);
if (attr & (TATTR_ACTCURS | TATTR_PASCURS))
win_draw_cursor(term->win, start, i, ch, ccount,
attr, ldata->lattr, tc);
}
unlineptr(ldata); unlineptr(ldata);
} }