mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 17:06:30 +00:00
tui: Move screen state tracking to new "ugrid" module
The ugrid module implements a unicode "drawing" grid and is used to store TUI screen state. Later this module will be reused in other layers.
This commit is contained in:
40
src/nvim/ugrid.h
Normal file
40
src/nvim/ugrid.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef NVIM_UGRID_H
|
||||
#define NVIM_UGRID_H
|
||||
|
||||
#include "nvim/ui.h"
|
||||
|
||||
typedef struct ucell UCell;
|
||||
typedef struct ugrid UGrid;
|
||||
|
||||
struct ucell {
|
||||
char data[7];
|
||||
HlAttrs attrs;
|
||||
};
|
||||
|
||||
struct ugrid {
|
||||
int top, bot, left, right;
|
||||
int row, col;
|
||||
int bg, fg;
|
||||
int width, height;
|
||||
HlAttrs attrs;
|
||||
UCell **cells;
|
||||
};
|
||||
|
||||
#define EMPTY_ATTRS ((HlAttrs){false, false, false, false, false, -1, -1})
|
||||
|
||||
#define UGRID_FOREACH_CELL(grid, top, bot, left, right, code) \
|
||||
do { \
|
||||
for (int row = top; row <= bot; ++row) { \
|
||||
UCell *row_cells = (grid)->cells[row]; \
|
||||
for (int col = left; col <= right; ++col) { \
|
||||
UCell *cell = row_cells + col; \
|
||||
(void)(cell); \
|
||||
code; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ugrid.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_UGRID_H
|
Reference in New Issue
Block a user