refactor(screen): simplify grid_clear() and win_draw_end()

grid_put_linebuf() used grid_clear() internally to handle clearing the
left part of a rightleft line. By reimplementing that internally, we
can instead use grid_put_linebuf() as the implementation of
grid_clear(), which in the end is a net reduction of code as grid_fill()
is used for nothing else.

win_draw_end: Implement "draw_margin" on a per-row basis which closer reflects how
terminals work. Also use the magic mirror for 'rightleft'
This commit is contained in:
bfredl
2024-01-04 14:07:25 +01:00
parent d54156ed08
commit 478b1af511
5 changed files with 129 additions and 207 deletions

View File

@@ -448,13 +448,12 @@ void ui_set_ext_option(UI *ui, UIExtension ext, bool active)
}
}
void ui_line(ScreenGrid *grid, int row, int startcol, int endcol, int clearcol, int clearattr,
bool wrap)
void ui_line(ScreenGrid *grid, int row, bool invalid_row, int startcol, int endcol, int clearcol,
int clearattr, bool wrap)
{
assert(0 <= row && row < grid->rows);
LineFlags flags = wrap ? kLineFlagWrap : 0;
if (startcol == -1) {
startcol = 0;
if (startcol == 0 && invalid_row) {
flags |= kLineFlagInvalid;
}