diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2018-09-26 12:20:57 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2018-09-26 19:30:21 +0200 |
commit | 1b8939d23321f5c7a818a5ba2125793797031835 (patch) | |
tree | 667190b7aade382b977ca1087badb61eb3d6fbf1 /src/nvim/ugrid.c | |
parent | fc18fad74ff3be9929d9d10de964f4813497fba0 (diff) | |
download | rneovim-1b8939d23321f5c7a818a5ba2125793797031835.tar.gz rneovim-1b8939d23321f5c7a818a5ba2125793797031835.tar.bz2 rneovim-1b8939d23321f5c7a818a5ba2125793797031835.zip |
tui: eliminate grid->attrs, use indexed cell->attr
remove dead ugrid_put
Diffstat (limited to 'src/nvim/ugrid.c')
-rw-r--r-- | src/nvim/ugrid.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/src/nvim/ugrid.c b/src/nvim/ugrid.c index 36936970f8..64d99bc649 100644 --- a/src/nvim/ugrid.c +++ b/src/nvim/ugrid.c @@ -16,7 +16,6 @@ void ugrid_init(UGrid *grid) { - grid->attrs = HLATTRS_INIT; grid->cells = NULL; } @@ -44,13 +43,12 @@ void ugrid_resize(UGrid *grid, int width, int height) void ugrid_clear(UGrid *grid) { - clear_region(grid, 0, grid->height-1, 0, grid->width-1, - HLATTRS_INIT); + clear_region(grid, 0, grid->height-1, 0, grid->width-1, 0); } -void ugrid_clear_chunk(UGrid *grid, int row, int col, int endcol, HlAttrs attrs) +void ugrid_clear_chunk(UGrid *grid, int row, int col, int endcol, sattr_T attr) { - clear_region(grid, row, row, col, endcol-1, attrs); + clear_region(grid, row, row, col, endcol-1, attr); } void ugrid_goto(UGrid *grid, int row, int col) @@ -99,32 +97,16 @@ void ugrid_scroll(UGrid *grid, int count, int *clear_top, int *clear_bot) *clear_bot = stop; *clear_top = stop + count + 1; } - clear_region(grid, *clear_top, *clear_bot, grid->left, grid->right, - HLATTRS_INIT); -} - -UCell *ugrid_put(UGrid *grid, uint8_t *text, size_t size) -{ - UCell *cell = grid->cells[grid->row] + grid->col; - cell->data[size] = 0; - cell->attrs = grid->attrs; - assert(size <= CELLBYTES); - - if (text) { - memcpy(cell->data, text, size); - } - - grid->col += 1; - return cell; + clear_region(grid, *clear_top, *clear_bot, grid->left, grid->right, 0); } static void clear_region(UGrid *grid, int top, int bot, int left, int right, - HlAttrs attrs) + sattr_T attr) { UGRID_FOREACH_CELL(grid, top, bot, left, right, { cell->data[0] = ' '; cell->data[1] = 0; - cell->attrs = attrs; + cell->attr = attr; }); } |