mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #25261 from bfredl/nolinewrap
refactor(grid): unused grid->line_wraps delenda est
This commit is contained in:
commit
50d5fcc0bc
@ -3172,9 +3172,6 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
|
||||
|
||||
// Force a redraw of the first column of the next line.
|
||||
current_grid->attrs[current_grid->line_offset[current_row + 1]] = -1;
|
||||
|
||||
// Remember that the line wraps, used for modeless copy.
|
||||
current_grid->line_wraps[current_row] = true;
|
||||
}
|
||||
|
||||
wlv.boguscols = 0;
|
||||
|
@ -215,7 +215,6 @@ void screenclear(void)
|
||||
for (int i = 0; i < default_grid.rows; i++) {
|
||||
grid_clear_line(&default_grid, default_grid.line_offset[i],
|
||||
default_grid.cols, true);
|
||||
default_grid.line_wraps[i] = false;
|
||||
}
|
||||
|
||||
ui_call_grid_clear(1); // clear the display
|
||||
|
@ -574,10 +574,6 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col, int
|
||||
ui_line(grid, row, dirty_first, last, dirty_last, attr, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (end_col == grid->cols) {
|
||||
grid->line_wraps[row] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -777,12 +773,6 @@ void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol, int cle
|
||||
}
|
||||
}
|
||||
|
||||
if (clear_width > 0 || wp->w_width != grid->cols) {
|
||||
// If we cleared after the end of the line, it did not wrap.
|
||||
// For vsplit, line wrapping is not possible.
|
||||
grid->line_wraps[row] = false;
|
||||
}
|
||||
|
||||
if (clear_end < end_dirty) {
|
||||
clear_end = end_dirty;
|
||||
}
|
||||
@ -806,14 +796,12 @@ void grid_alloc(ScreenGrid *grid, int rows, int columns, bool copy, bool valid)
|
||||
ngrid.vcols = xmalloc(ncells * sizeof(colnr_T));
|
||||
memset(ngrid.vcols, -1, ncells * sizeof(colnr_T));
|
||||
ngrid.line_offset = xmalloc((size_t)rows * sizeof(*ngrid.line_offset));
|
||||
ngrid.line_wraps = xmalloc((size_t)rows * sizeof(*ngrid.line_wraps));
|
||||
|
||||
ngrid.rows = rows;
|
||||
ngrid.cols = columns;
|
||||
|
||||
for (new_row = 0; new_row < ngrid.rows; new_row++) {
|
||||
ngrid.line_offset[new_row] = (size_t)new_row * (size_t)ngrid.cols;
|
||||
ngrid.line_wraps[new_row] = false;
|
||||
|
||||
grid_clear_line(&ngrid, ngrid.line_offset[new_row], columns, valid);
|
||||
|
||||
@ -858,13 +846,11 @@ void grid_free(ScreenGrid *grid)
|
||||
xfree(grid->attrs);
|
||||
xfree(grid->vcols);
|
||||
xfree(grid->line_offset);
|
||||
xfree(grid->line_wraps);
|
||||
|
||||
grid->chars = NULL;
|
||||
grid->attrs = NULL;
|
||||
grid->vcols = NULL;
|
||||
grid->line_offset = NULL;
|
||||
grid->line_wraps = NULL;
|
||||
}
|
||||
|
||||
/// Doesn't allow reinit, so must only be called by free_all_mem!
|
||||
@ -987,16 +973,13 @@ void grid_ins_lines(ScreenGrid *grid, int row, int line_count, int end, int col,
|
||||
}
|
||||
j += line_count;
|
||||
grid_clear_line(grid, grid->line_offset[j] + (size_t)col, width, false);
|
||||
grid->line_wraps[j] = false;
|
||||
} else {
|
||||
j = end - 1 - i;
|
||||
temp = (unsigned)grid->line_offset[j];
|
||||
while ((j -= line_count) >= row) {
|
||||
grid->line_offset[j + line_count] = grid->line_offset[j];
|
||||
grid->line_wraps[j + line_count] = grid->line_wraps[j];
|
||||
}
|
||||
grid->line_offset[j + line_count] = temp;
|
||||
grid->line_wraps[j + line_count] = false;
|
||||
grid_clear_line(grid, temp, grid->cols, false);
|
||||
}
|
||||
}
|
||||
@ -1035,17 +1018,14 @@ void grid_del_lines(ScreenGrid *grid, int row, int line_count, int end, int col,
|
||||
}
|
||||
j -= line_count;
|
||||
grid_clear_line(grid, grid->line_offset[j] + (size_t)col, width, false);
|
||||
grid->line_wraps[j] = false;
|
||||
} else {
|
||||
// whole width, moving the line pointers is faster
|
||||
j = row + i;
|
||||
temp = (unsigned)grid->line_offset[j];
|
||||
while ((j += line_count) <= end - 1) {
|
||||
grid->line_offset[j - line_count] = grid->line_offset[j];
|
||||
grid->line_wraps[j - line_count] = grid->line_wraps[j];
|
||||
}
|
||||
grid->line_offset[j - line_count] = temp;
|
||||
grid->line_wraps[j - line_count] = false;
|
||||
grid_clear_line(grid, temp, grid->cols, false);
|
||||
}
|
||||
}
|
||||
|
@ -52,10 +52,6 @@ enum {
|
||||
/// line_offset[n] is the offset from chars[], attrs[] and vcols[] for the start
|
||||
/// of line 'n'. These offsets are in general not linear, as full screen scrolling
|
||||
/// is implemented by rotating the offsets in the line_offset array.
|
||||
///
|
||||
/// line_wraps[] is an array of boolean flags indicating if the screen line
|
||||
/// wraps to the next line. It can only be true if a window occupies the entire
|
||||
/// screen width.
|
||||
typedef struct ScreenGrid ScreenGrid;
|
||||
struct ScreenGrid {
|
||||
handle_T handle;
|
||||
@ -64,7 +60,6 @@ struct ScreenGrid {
|
||||
sattr_T *attrs;
|
||||
colnr_T *vcols;
|
||||
size_t *line_offset;
|
||||
char *line_wraps;
|
||||
|
||||
// last column that was drawn (not cleared with the default background).
|
||||
// only used when "throttled" is set. Not allocated by grid_alloc!
|
||||
@ -120,7 +115,7 @@ struct ScreenGrid {
|
||||
bool comp_disabled;
|
||||
};
|
||||
|
||||
#define SCREEN_GRID_INIT { 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, false, \
|
||||
#define SCREEN_GRID_INIT { 0, NULL, NULL, NULL, NULL, NULL, 0, 0, false, \
|
||||
false, 0, 0, NULL, false, true, 0, \
|
||||
0, 0, 0, 0, 0, false }
|
||||
|
||||
|
@ -413,9 +413,7 @@ static void compose_line(Integer row, Integer startcol, Integer endcol, LineFlag
|
||||
assert(endcol <= chk_width);
|
||||
assert(row < chk_height);
|
||||
|
||||
if (!(grid && grid == &default_grid)) {
|
||||
// TODO(bfredl): too conservative, need check
|
||||
// grid->line_wraps if grid->Width == Width
|
||||
if (!(grid && (grid == &default_grid || (grid->comp_col == 0 && grid->cols == Columns)))) {
|
||||
flags = flags & ~kLineFlagWrap;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user