multigrid: Add ScreenGrid as a param to multibyte functions

This commit is contained in:
Utkarsh Maheshwari
2018-08-17 18:41:52 +05:30
committed by Björn Linse
parent 911b731378
commit 0bab611a96
3 changed files with 30 additions and 30 deletions

View File

@@ -4323,7 +4323,7 @@ static int grid_char_needs_redraw(ScreenGrid *grid, int off_from, int off_to,
return (cols > 0
&& ((schar_cmp(grid->ScreenLines[off_from], grid->ScreenLines[off_to])
|| grid->ScreenAttrs[off_from] != grid->ScreenAttrs[off_to]
|| (utf_off2cells(off_from, off_from + cols) > 1
|| (utf_off2cells(grid, off_from, off_from + cols) > 1
&& schar_cmp(grid->ScreenLines[off_from + 1],
grid->ScreenLines[off_to + 1])))
|| p_wd < 0));
@@ -4417,7 +4417,7 @@ static void grid_move_line(ScreenGrid *grid, int row, int coloff, int endcol,
while (col < endcol) {
char_cells = 1;
if (col + 1 < endcol) {
char_cells = utf_off2cells(off_from, max_off_from);
char_cells = utf_off2cells(grid, off_from, max_off_from);
}
redraw_this = redraw_next;
redraw_next = grid_char_needs_redraw(grid, off_from + char_cells,
@@ -4436,10 +4436,10 @@ static void grid_move_line(ScreenGrid *grid, int row, int coloff, int endcol,
// char over the left halve of an existing one
if (col + char_cells == endcol
&& ((char_cells == 1
&& utf_off2cells(off_to, max_off_to) > 1)
&& utf_off2cells(grid, off_to, max_off_to) > 1)
|| (char_cells == 2
&& utf_off2cells(off_to, max_off_to) == 1
&& utf_off2cells(off_to + 1, max_off_to) > 1))) {
&& utf_off2cells(grid, off_to, max_off_to) == 1
&& utf_off2cells(grid, off_to + 1, max_off_to) > 1))) {
clear_next = true;
}
@@ -5361,7 +5361,7 @@ void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row,
/* When drawing over the right halve of a double-wide char clear out the
* left halve. Only needed in a terminal. */
if (col > 0 && col < grid->Columns && mb_fix_col(col, row) != col) {
if (col > 0 && col < grid->Columns && mb_fix_col(grid, col, row) != col) {
schar_from_ascii(grid->ScreenLines[off - 1], ' ');
grid->ScreenAttrs[off - 1] = 0;
// redraw the previous cell, make it empty
@@ -5436,10 +5436,10 @@ void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row,
clear_next_cell = false;
} else if ((len < 0 ? ptr[mbyte_blen] == NUL
: ptr + mbyte_blen >= text + len)
&& ((mbyte_cells == 1 && utf_off2cells(off, max_off) > 1)
&& ((mbyte_cells == 1 && utf_off2cells(grid, off, max_off) > 1)
|| (mbyte_cells == 2
&& utf_off2cells(off, max_off) == 1
&& utf_off2cells(off + 1, max_off) > 1))) {
&& utf_off2cells(grid, off, max_off) == 1
&& utf_off2cells(grid, off + 1, max_off) > 1))) {
clear_next_cell = true;
}
@@ -5824,10 +5824,10 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
// out the left halve. When drawing over the left halve of a
// double wide-char clear out the right halve. Only needed in a
// terminal.
if (start_col > 0 && mb_fix_col(start_col, row) != start_col) {
if (start_col > 0 && mb_fix_col(grid, start_col, row) != start_col) {
grid_puts_len(grid, (char_u *)" ", 1, row, start_col - 1, 0);
}
if (end_col < grid->Columns && mb_fix_col(end_col, row) != end_col) {
if (end_col < grid->Columns && mb_fix_col(grid, end_col, row) != end_col) {
grid_puts_len(grid, (char_u *)" ", 1, row, end_col, 0);
}
}
@@ -7076,7 +7076,7 @@ int number_width(win_T *wp)
if (wp->w_p_rnu && !wp->w_p_nu)
/* cursor line shows "0" */
lnum = wp->w_height;
lnum = wp->w_grid.Rows;
else
/* cursor line shows absolute line number */
lnum = wp->w_buffer->b_ml.ml_line_count;