mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 14:28:18 +00:00
linter: fix issues
This commit is contained in:
@@ -3677,9 +3677,9 @@ int build_stl_str_hl(
|
|||||||
// In list mode virtcol needs to be recomputed
|
// In list mode virtcol needs to be recomputed
|
||||||
colnr_T virtcol = wp->w_virtcol;
|
colnr_T virtcol = wp->w_virtcol;
|
||||||
if (wp->w_p_list && wp->w_p_lcs_chars.tab1 == NUL) {
|
if (wp->w_p_list && wp->w_p_lcs_chars.tab1 == NUL) {
|
||||||
wp->w_p_list = FALSE;
|
wp->w_p_list = false;
|
||||||
getvcol(wp, &wp->w_cursor, NULL, &virtcol, NULL);
|
getvcol(wp, &wp->w_cursor, NULL, &virtcol, NULL);
|
||||||
wp->w_p_list = TRUE;
|
wp->w_p_list = true;
|
||||||
}
|
}
|
||||||
++virtcol;
|
++virtcol;
|
||||||
// Don't display %V if it's the same as %c.
|
// Don't display %V if it's the same as %c.
|
||||||
|
@@ -750,7 +750,7 @@ int vim_strnsize(char_u *s, int len)
|
|||||||
/// @return Number of characters.
|
/// @return Number of characters.
|
||||||
#define RET_WIN_BUF_CHARTABSIZE(wp, buf, p, col) \
|
#define RET_WIN_BUF_CHARTABSIZE(wp, buf, p, col) \
|
||||||
if (*(p) == TAB && (!(wp)->w_p_list || wp->w_p_lcs_chars.tab1)) { \
|
if (*(p) == TAB && (!(wp)->w_p_list || wp->w_p_lcs_chars.tab1)) { \
|
||||||
const int ts = (int) (buf)->b_p_ts; \
|
const int ts = (int)(buf)->b_p_ts; \
|
||||||
return (ts - (int)(col % ts)); \
|
return (ts - (int)(col % ts)); \
|
||||||
} else { \
|
} else { \
|
||||||
return ptr2cells(p); \
|
return ptr2cells(p); \
|
||||||
|
@@ -61,7 +61,8 @@ int get_indent_str(char_u *ptr, int ts, int list)
|
|||||||
for (; *ptr; ++ptr) {
|
for (; *ptr; ++ptr) {
|
||||||
// Count a tab for what it is worth.
|
// Count a tab for what it is worth.
|
||||||
if (*ptr == TAB) {
|
if (*ptr == TAB) {
|
||||||
if (!list || curwin->w_p_lcs_chars.tab1) { // count a tab for what it is worth
|
if (!list || curwin->w_p_lcs_chars.tab1) {
|
||||||
|
// count a tab for what it is worth
|
||||||
count += ts - (count % ts);
|
count += ts - (count % ts);
|
||||||
} else {
|
} else {
|
||||||
// In list mode, when tab is not set, count screen char width
|
// In list mode, when tab is not set, count screen char width
|
||||||
|
@@ -1523,20 +1523,22 @@ void msg_prt_line(char_u *s, int list)
|
|||||||
char_u *trail = NULL;
|
char_u *trail = NULL;
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
if (curwin->w_p_list)
|
if (curwin->w_p_list) {
|
||||||
list = TRUE;
|
list = true;
|
||||||
|
|
||||||
/* find start of trailing whitespace */
|
|
||||||
if (list && curwin->w_p_lcs_chars.trail) {
|
|
||||||
trail = s + STRLEN(s);
|
|
||||||
while (trail > s && ascii_iswhite(trail[-1]))
|
|
||||||
--trail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* output a space for an empty line, otherwise the line will be
|
// find start of trailing whitespace
|
||||||
* overwritten */
|
if (list && curwin->w_p_lcs_chars.trail) {
|
||||||
if (*s == NUL && !(list && curwin->w_p_lcs_chars.eol != NUL))
|
trail = s + STRLEN(s);
|
||||||
|
while (trail > s && ascii_iswhite(trail[-1])) {
|
||||||
|
trail--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// output a space for an empty line, otherwise the line will be overwritten
|
||||||
|
if (*s == NUL && !(list && curwin->w_p_lcs_chars.eol != NUL)) {
|
||||||
msg_putchar(' ');
|
msg_putchar(' ');
|
||||||
|
}
|
||||||
|
|
||||||
while (!got_int) {
|
while (!got_int) {
|
||||||
if (n_extra > 0) {
|
if (n_extra > 0) {
|
||||||
@@ -1565,7 +1567,7 @@ void msg_prt_line(char_u *s, int list)
|
|||||||
attr = 0;
|
attr = 0;
|
||||||
c = *s++;
|
c = *s++;
|
||||||
if (c == TAB && (!list || curwin->w_p_lcs_chars.tab1)) {
|
if (c == TAB && (!list || curwin->w_p_lcs_chars.tab1)) {
|
||||||
/* tab amount depends on current column */
|
// tab amount depends on current column
|
||||||
n_extra = curbuf->b_p_ts - col % curbuf->b_p_ts - 1;
|
n_extra = curbuf->b_p_ts - col % curbuf->b_p_ts - 1;
|
||||||
if (!list) {
|
if (!list) {
|
||||||
c = ' ';
|
c = ' ';
|
||||||
|
@@ -1282,12 +1282,11 @@ int plines_win_nofold(win_T *wp, linenr_T lnum)
|
|||||||
return 1;
|
return 1;
|
||||||
col = win_linetabsize(wp, s, (colnr_T)MAXCOL);
|
col = win_linetabsize(wp, s, (colnr_T)MAXCOL);
|
||||||
|
|
||||||
/*
|
// If list mode is on, then the '$' at the end of the line may take up one
|
||||||
* If list mode is on, then the '$' at the end of the line may take up one
|
// extra column.
|
||||||
* extra column.
|
if (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL) {
|
||||||
*/
|
|
||||||
if (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL)
|
|
||||||
col += 1;
|
col += 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add column offset for 'number', 'relativenumber' and 'foldcolumn'.
|
* Add column offset for 'number', 'relativenumber' and 'foldcolumn'.
|
||||||
@@ -1336,7 +1335,8 @@ int plines_win_col(win_T *wp, linenr_T lnum, long column)
|
|||||||
// screen position of the TAB. This only fixes an error when the TAB wraps
|
// screen position of the TAB. This only fixes an error when the TAB wraps
|
||||||
// from one screen line to the next (when 'columns' is not a multiple of
|
// from one screen line to the next (when 'columns' is not a multiple of
|
||||||
// 'ts') -- webb.
|
// 'ts') -- webb.
|
||||||
if (*s == TAB && (State & NORMAL) && (!wp->w_p_list || wp->w_p_lcs_chars.tab1)) {
|
if (*s == TAB && (State & NORMAL)
|
||||||
|
&& (!wp->w_p_list || wp->w_p_lcs_chars.tab1)) {
|
||||||
col += win_lbr_chartabsize(wp, line, s, col, NULL) - 1;
|
col += win_lbr_chartabsize(wp, line, s, col, NULL) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3494,9 +3494,9 @@ static char_u *set_chars_option(win_T *wp, char_u **varp)
|
|||||||
if (tab[i].cp == &wp->w_p_lcs_chars.tab2) {
|
if (tab[i].cp == &wp->w_p_lcs_chars.tab2) {
|
||||||
wp->w_p_lcs_chars.tab1 = c1;
|
wp->w_p_lcs_chars.tab1 = c1;
|
||||||
wp->w_p_lcs_chars.tab2 = c2;
|
wp->w_p_lcs_chars.tab2 = c2;
|
||||||
} else if (tab[i].cp != NULL)
|
} else if (tab[i].cp != NULL) {
|
||||||
*(tab[i].cp) = c1;
|
*(tab[i].cp) = c1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
p = s;
|
p = s;
|
||||||
break;
|
break;
|
||||||
|
@@ -1448,13 +1448,12 @@ static void win_update(win_T *wp)
|
|||||||
wp->w_botline = buf->b_ml.ml_line_count + 1;
|
wp->w_botline = buf->b_ml.ml_line_count + 1;
|
||||||
j = diff_check_fill(wp, wp->w_botline);
|
j = diff_check_fill(wp, wp->w_botline);
|
||||||
if (j > 0 && !wp->w_botfill) {
|
if (j > 0 && !wp->w_botfill) {
|
||||||
/*
|
// display filler lines at the end of the file
|
||||||
* Display filler lines at the end of the file
|
if (char2cells(wp->w_p_fcs_chars.diff) > 1) {
|
||||||
*/
|
|
||||||
if (char2cells(wp->w_p_fcs_chars.diff) > 1)
|
|
||||||
i = '-';
|
i = '-';
|
||||||
else
|
} else {
|
||||||
i = wp->w_p_fcs_chars.diff;
|
i = wp->w_p_fcs_chars.diff;
|
||||||
|
}
|
||||||
if (row + j > wp->w_grid.Rows) {
|
if (row + j > wp->w_grid.Rows) {
|
||||||
j = wp->w_grid.Rows - row;
|
j = wp->w_grid.Rows - row;
|
||||||
}
|
}
|
||||||
@@ -2042,25 +2041,26 @@ win_line (
|
|||||||
bool number_only // only update the number column
|
bool number_only // only update the number column
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int c = 0; // init for GCC
|
int c = 0; // init for GCC
|
||||||
long vcol = 0; // virtual column (for tabs)
|
long vcol = 0; // virtual column (for tabs)
|
||||||
long vcol_sbr = -1; // virtual column after showbreak
|
long vcol_sbr = -1; // virtual column after showbreak
|
||||||
long vcol_prev = -1; // "vcol" of previous character
|
long vcol_prev = -1; // "vcol" of previous character
|
||||||
char_u *line; // current line
|
char_u *line; // current line
|
||||||
char_u *ptr; // current position in "line"
|
char_u *ptr; // current position in "line"
|
||||||
int row; // row in the window, excl w_winrow
|
int row; // row in the window, excl w_winrow
|
||||||
ScreenGrid *grid = &wp->w_grid; // grid specfic to the window
|
ScreenGrid *grid = &wp->w_grid; // grid specfic to the window
|
||||||
|
|
||||||
char_u extra[18]; /* line number and 'fdc' must fit in here */
|
char_u extra[18]; // line number and 'fdc' must fit in here
|
||||||
int n_extra = 0; /* number of extra chars */
|
int n_extra = 0; // number of extra chars
|
||||||
char_u *p_extra = NULL; /* string of extra chars, plus NUL */
|
char_u *p_extra = NULL; // string of extra chars, plus NUL
|
||||||
char_u *p_extra_free = NULL; /* p_extra needs to be freed */
|
char_u *p_extra_free = NULL; // p_extra needs to be freed
|
||||||
int c_extra = NUL; /* extra chars, all the same */
|
int c_extra = NUL; // extra chars, all the same
|
||||||
int extra_attr = 0; /* attributes when n_extra != 0 */
|
int extra_attr = 0; // attributes when n_extra != 0
|
||||||
static char_u *at_end_str = (char_u *)""; // used for p_extra when displaying
|
static char_u *at_end_str = (char_u *)""; // used for p_extra when displaying
|
||||||
// curwin->w_p_lcs_chars.eol at end-of-line
|
// curwin->w_p_lcs_chars.eol at
|
||||||
int lcs_eol_one = wp->w_p_lcs_chars.eol; // 'eol' until it's been used
|
// end-of-line
|
||||||
int lcs_prec_todo = wp->w_p_lcs_chars.prec; // 'prec' until it's been used
|
int lcs_eol_one = wp->w_p_lcs_chars.eol; // 'eol' until it's been used
|
||||||
|
int lcs_prec_todo = wp->w_p_lcs_chars.prec; // 'prec' until it's been used
|
||||||
|
|
||||||
/* saved "extra" items for when draw_state becomes WL_LINE (again) */
|
/* saved "extra" items for when draw_state becomes WL_LINE (again) */
|
||||||
int saved_n_extra = 0;
|
int saved_n_extra = 0;
|
||||||
@@ -2792,11 +2792,12 @@ win_line (
|
|||||||
if (draw_state == WL_SBR - 1 && n_extra == 0) {
|
if (draw_state == WL_SBR - 1 && n_extra == 0) {
|
||||||
draw_state = WL_SBR;
|
draw_state = WL_SBR;
|
||||||
if (filler_todo > 0) {
|
if (filler_todo > 0) {
|
||||||
/* Draw "deleted" diff line(s). */
|
// draw "deleted" diff line(s)
|
||||||
if (char2cells(wp->w_p_fcs_chars.diff) > 1)
|
if (char2cells(wp->w_p_fcs_chars.diff) > 1) {
|
||||||
c_extra = '-';
|
c_extra = '-';
|
||||||
else
|
} else {
|
||||||
c_extra = wp->w_p_fcs_chars.diff;
|
c_extra = wp->w_p_fcs_chars.diff;
|
||||||
|
}
|
||||||
if (wp->w_p_rl) {
|
if (wp->w_p_rl) {
|
||||||
n_extra = col + 1;
|
n_extra = col + 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -3406,7 +3407,8 @@ win_line (
|
|||||||
&& (((c == 160
|
&& (((c == 160
|
||||||
|| (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
|
|| (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
|
||||||
&& curwin->w_p_lcs_chars.nbsp)
|
&& curwin->w_p_lcs_chars.nbsp)
|
||||||
|| (c == ' ' && curwin->w_p_lcs_chars.space && ptr - line <= trailcol))) {
|
|| (c == ' ' && curwin->w_p_lcs_chars.space
|
||||||
|
&& ptr - line <= trailcol))) {
|
||||||
c = (c == ' ') ? wp->w_p_lcs_chars.space : wp->w_p_lcs_chars.nbsp;
|
c = (c == ' ') ? wp->w_p_lcs_chars.space : wp->w_p_lcs_chars.nbsp;
|
||||||
n_attr = 1;
|
n_attr = 1;
|
||||||
extra_attr = win_hl_attr(wp, HLF_0);
|
extra_attr = win_hl_attr(wp, HLF_0);
|
||||||
@@ -3467,7 +3469,8 @@ win_line (
|
|||||||
tab_len += vcol_off;
|
tab_len += vcol_off;
|
||||||
}
|
}
|
||||||
// boguscols before FIX_FOR_BOGUSCOLS macro from above.
|
// boguscols before FIX_FOR_BOGUSCOLS macro from above.
|
||||||
if (wp->w_p_lcs_chars.tab1 && old_boguscols > 0 && n_extra > tab_len) {
|
if (wp->w_p_lcs_chars.tab1 && old_boguscols > 0
|
||||||
|
&& n_extra > tab_len) {
|
||||||
tab_len += n_extra - tab_len;
|
tab_len += n_extra - tab_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3486,7 +3489,8 @@ win_line (
|
|||||||
for (i = 0; i < tab_len; i++) {
|
for (i = 0; i < tab_len; i++) {
|
||||||
utf_char2bytes(wp->w_p_lcs_chars.tab2, p);
|
utf_char2bytes(wp->w_p_lcs_chars.tab2, p);
|
||||||
p += mb_char2len(wp->w_p_lcs_chars.tab2);
|
p += mb_char2len(wp->w_p_lcs_chars.tab2);
|
||||||
n_extra += mb_char2len(wp->w_p_lcs_chars.tab2) - (saved_nextra > 0 ? 1: 0);
|
n_extra += mb_char2len(wp->w_p_lcs_chars.tab2)
|
||||||
|
- (saved_nextra > 0 ? 1: 0);
|
||||||
}
|
}
|
||||||
p_extra = p_extra_free;
|
p_extra = p_extra_free;
|
||||||
|
|
||||||
@@ -3511,7 +3515,8 @@ win_line (
|
|||||||
// Make sure, the highlighting for the tab char will be
|
// Make sure, the highlighting for the tab char will be
|
||||||
// correctly set further below (effectively reverts the
|
// correctly set further below (effectively reverts the
|
||||||
// FIX_FOR_BOGSUCOLS macro.
|
// FIX_FOR_BOGSUCOLS macro.
|
||||||
if (n_extra == tab_len + vc_saved && wp->w_p_list && wp->w_p_lcs_chars.tab1) {
|
if (n_extra == tab_len + vc_saved && wp->w_p_list
|
||||||
|
&& wp->w_p_lcs_chars.tab1) {
|
||||||
tab_len += vc_saved;
|
tab_len += vc_saved;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3858,7 +3863,8 @@ win_line (
|
|||||||
|
|
||||||
// Make sure alignment is the same regardless
|
// Make sure alignment is the same regardless
|
||||||
// if listchars=eol:X is used or not.
|
// if listchars=eol:X is used or not.
|
||||||
bool delay_virttext = wp->w_p_lcs_chars.eol == lcs_eol_one && eol_hl_off == 0;
|
bool delay_virttext = wp->w_p_lcs_chars.eol == lcs_eol_one
|
||||||
|
&& eol_hl_off == 0;
|
||||||
|
|
||||||
if (wp->w_p_cuc) {
|
if (wp->w_p_cuc) {
|
||||||
rightmost_vcol = wp->w_virtcol;
|
rightmost_vcol = wp->w_virtcol;
|
||||||
@@ -3978,7 +3984,7 @@ win_line (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line continues beyond line end */
|
// line continues beyond line end
|
||||||
if (wp->w_p_lcs_chars.ext
|
if (wp->w_p_lcs_chars.ext
|
||||||
&& !wp->w_p_wrap
|
&& !wp->w_p_wrap
|
||||||
&& filler_todo <= 0
|
&& filler_todo <= 0
|
||||||
@@ -4164,7 +4170,8 @@ win_line (
|
|||||||
if ((wp->w_p_rl ? (col < 0) : (col >= grid->Columns))
|
if ((wp->w_p_rl ? (col < 0) : (col >= grid->Columns))
|
||||||
&& (*ptr != NUL
|
&& (*ptr != NUL
|
||||||
|| filler_todo > 0
|
|| filler_todo > 0
|
||||||
|| (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL && p_extra != at_end_str)
|
|| (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL
|
||||||
|
&& p_extra != at_end_str)
|
||||||
|| (n_extra != 0 && (c_extra != NUL || *p_extra != NUL)))
|
|| (n_extra != 0 && (c_extra != NUL || *p_extra != NUL)))
|
||||||
) {
|
) {
|
||||||
bool wrap = wp->w_p_wrap // Wrapping enabled.
|
bool wrap = wp->w_p_wrap // Wrapping enabled.
|
||||||
@@ -4227,13 +4234,15 @@ win_line (
|
|||||||
saved_char_attr = char_attr;
|
saved_char_attr = char_attr;
|
||||||
n_extra = 0;
|
n_extra = 0;
|
||||||
lcs_prec_todo = wp->w_p_lcs_chars.prec;
|
lcs_prec_todo = wp->w_p_lcs_chars.prec;
|
||||||
if (filler_todo <= 0)
|
if (filler_todo <= 0) {
|
||||||
need_showbreak = TRUE;
|
need_showbreak = true;
|
||||||
--filler_todo;
|
}
|
||||||
/* When the filler lines are actually below the last line of the
|
filler_todo--;
|
||||||
* file, don't draw the line itself, break here. */
|
// When the filler lines are actually below the last line of the
|
||||||
if (filler_todo == 0 && wp->w_botfill)
|
// file, don't draw the line itself, break here.
|
||||||
|
if (filler_todo == 0 && wp->w_botfill) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* for every character in the line */
|
} /* for every character in the line */
|
||||||
@@ -7001,12 +7010,12 @@ static void win_redr_ruler(win_T *wp, int always)
|
|||||||
off = 0;
|
off = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In list mode virtcol needs to be recomputed */
|
// In list mode virtcol needs to be recomputed
|
||||||
colnr_T virtcol = wp->w_virtcol;
|
colnr_T virtcol = wp->w_virtcol;
|
||||||
if (wp->w_p_list && wp->w_p_lcs_chars.tab1 == NUL) {
|
if (wp->w_p_list && wp->w_p_lcs_chars.tab1 == NUL) {
|
||||||
wp->w_p_list = FALSE;
|
wp->w_p_list = false;
|
||||||
getvvcol(wp, &wp->w_cursor, NULL, &virtcol, NULL);
|
getvvcol(wp, &wp->w_cursor, NULL, &virtcol, NULL);
|
||||||
wp->w_p_list = TRUE;
|
wp->w_p_list = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RULER_BUF_LEN 70
|
#define RULER_BUF_LEN 70
|
||||||
|
Reference in New Issue
Block a user