diff options
author | zeertzjq <zeertzjq@outlook.com> | 2021-12-24 08:06:27 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2021-12-24 08:06:27 +0800 |
commit | 4f70b31f7aee3a34c8d6b5c63184f97b0c1dcbce (patch) | |
tree | aea3a169cbe2f4022dc8088dc23efade1ca5e46a | |
parent | e6d35b9e4011023a4efd06234fe2fd2c5f7dc829 (diff) | |
download | rneovim-4f70b31f7aee3a34c8d6b5c63184f97b0c1dcbce.tar.gz rneovim-4f70b31f7aee3a34c8d6b5c63184f97b0c1dcbce.tar.bz2 rneovim-4f70b31f7aee3a34c8d6b5c63184f97b0c1dcbce.zip |
refactor(pum_redraw): rename col -> grid_col
This is initialized to `col_off`, while in Vim this variable `col` that
is used in the same places is initialized to `pum_col`. This can cause
confusion in patch porting, and it caused Vim patch 8.2.1995 to be
ported incorrectly. (I reverted the incorrect part in the last commit
though.) Rename it to `grid_col` to make it clear that it is different
from Vim's `col` variable.
-rw-r--r-- | src/nvim/popupmnu.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index b253077844..da2ada791f 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -386,7 +386,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i void pum_redraw(void) { int row = 0; - int col; + int grid_col; int attr_norm = win_hl_attr(curwin, HLF_PNI); int attr_select = win_hl_attr(curwin, HLF_PSI); int attr_scroll = win_hl_attr(curwin, HLF_PSB); @@ -479,7 +479,7 @@ void pum_redraw(void) // Display each entry, use two spaces for a Tab. // Do this 3 times: For the main text, kind and extra info - col = col_off; + grid_col = col_off; totwidth = 0; for (round = 1; round <= 3; ++round) { @@ -537,15 +537,15 @@ void pum_redraw(void) } } grid_puts_len(&pum_grid, rt, (int)STRLEN(rt), row, - col - size + 1, attr); + grid_col - size + 1, attr); xfree(rt_start); xfree(st); - col -= width; + grid_col -= width; } else { // use grid_puts_len() to truncate the text - grid_puts(&pum_grid, st, row, col, attr); + grid_puts(&pum_grid, st, row, grid_col, attr); xfree(st); - col += width; + grid_col += width; } if (*p != TAB) { @@ -554,12 +554,12 @@ void pum_redraw(void) // Display two spaces for a Tab. if (pum_rl) { - grid_puts_len(&pum_grid, (char_u *)" ", 2, row, col - 1, + grid_puts_len(&pum_grid, (char_u *)" ", 2, row, grid_col - 1, attr); - col -= 2; + grid_col -= 2; } else { - grid_puts_len(&pum_grid, (char_u *)" ", 2, row, col, attr); - col += 2; + grid_puts_len(&pum_grid, (char_u *)" ", 2, row, grid_col, attr); + grid_col += 2; } totwidth += 2; // start text at next char @@ -590,21 +590,21 @@ void pum_redraw(void) if (pum_rl) { grid_fill(&pum_grid, row, row + 1, col_off - pum_base_width - n + 1, - col + 1, ' ', ' ', attr); - col = col_off - pum_base_width - n + 1; + grid_col + 1, ' ', ' ', attr); + grid_col = col_off - pum_base_width - n + 1; } else { - grid_fill(&pum_grid, row, row + 1, col, + grid_fill(&pum_grid, row, row + 1, grid_col, col_off + pum_base_width + n, ' ', ' ', attr); - col = col_off + pum_base_width + n; + grid_col = col_off + pum_base_width + n; } totwidth = pum_base_width + n; } if (pum_rl) { - grid_fill(&pum_grid, row, row + 1, col_off - pum_width + 1, col + 1, + grid_fill(&pum_grid, row, row + 1, col_off - pum_width + 1, grid_col + 1, ' ', ' ', attr); } else { - grid_fill(&pum_grid, row, row + 1, col, col_off + pum_width, ' ', ' ', + grid_fill(&pum_grid, row, row + 1, grid_col, col_off + pum_width, ' ', ' ', attr); } |