mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 19:25:11 -07:00
linter: fix issues
This commit is contained in:
parent
df5534f576
commit
2418aa3a4a
@ -3677,9 +3677,9 @@ int build_stl_str_hl(
|
||||
// In list mode virtcol needs to be recomputed
|
||||
colnr_T virtcol = wp->w_virtcol;
|
||||
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);
|
||||
wp->w_p_list = TRUE;
|
||||
wp->w_p_list = true;
|
||||
}
|
||||
++virtcol;
|
||||
// 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.
|
||||
#define RET_WIN_BUF_CHARTABSIZE(wp, buf, p, col) \
|
||||
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)); \
|
||||
} else { \
|
||||
return ptr2cells(p); \
|
||||
|
@ -61,7 +61,8 @@ int get_indent_str(char_u *ptr, int ts, int list)
|
||||
for (; *ptr; ++ptr) {
|
||||
// Count a tab for what it is worth.
|
||||
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);
|
||||
} else {
|
||||
// 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;
|
||||
int l;
|
||||
|
||||
if (curwin->w_p_list)
|
||||
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;
|
||||
if (curwin->w_p_list) {
|
||||
list = true;
|
||||
}
|
||||
|
||||
/* output a space for an empty line, otherwise the line will be
|
||||
* overwritten */
|
||||
if (*s == NUL && !(list && curwin->w_p_lcs_chars.eol != NUL))
|
||||
// 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 overwritten
|
||||
if (*s == NUL && !(list && curwin->w_p_lcs_chars.eol != NUL)) {
|
||||
msg_putchar(' ');
|
||||
}
|
||||
|
||||
while (!got_int) {
|
||||
if (n_extra > 0) {
|
||||
@ -1565,7 +1567,7 @@ void msg_prt_line(char_u *s, int list)
|
||||
attr = 0;
|
||||
c = *s++;
|
||||
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;
|
||||
if (!list) {
|
||||
c = ' ';
|
||||
|
@ -1282,12 +1282,11 @@ int plines_win_nofold(win_T *wp, linenr_T lnum)
|
||||
return 1;
|
||||
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
|
||||
* extra column.
|
||||
*/
|
||||
if (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL)
|
||||
// If list mode is on, then the '$' at the end of the line may take up one
|
||||
// extra column.
|
||||
if (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL) {
|
||||
col += 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
// from one screen line to the next (when 'columns' is not a multiple of
|
||||
// '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;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
wp->w_p_lcs_chars.tab1 = c1;
|
||||
wp->w_p_lcs_chars.tab2 = c2;
|
||||
} else if (tab[i].cp != NULL)
|
||||
} else if (tab[i].cp != NULL) {
|
||||
*(tab[i].cp) = c1;
|
||||
|
||||
}
|
||||
}
|
||||
p = s;
|
||||
break;
|
||||
|
@ -1448,13 +1448,12 @@ static void win_update(win_T *wp)
|
||||
wp->w_botline = buf->b_ml.ml_line_count + 1;
|
||||
j = diff_check_fill(wp, wp->w_botline);
|
||||
if (j > 0 && !wp->w_botfill) {
|
||||
/*
|
||||
* Display filler lines at the end of the file
|
||||
*/
|
||||
if (char2cells(wp->w_p_fcs_chars.diff) > 1)
|
||||
// display filler lines at the end of the file
|
||||
if (char2cells(wp->w_p_fcs_chars.diff) > 1) {
|
||||
i = '-';
|
||||
else
|
||||
} else {
|
||||
i = wp->w_p_fcs_chars.diff;
|
||||
}
|
||||
if (row + j > wp->w_grid.Rows) {
|
||||
j = wp->w_grid.Rows - row;
|
||||
}
|
||||
@ -2042,25 +2041,26 @@ win_line (
|
||||
bool number_only // only update the number column
|
||||
)
|
||||
{
|
||||
int c = 0; // init for GCC
|
||||
long vcol = 0; // virtual column (for tabs)
|
||||
long vcol_sbr = -1; // virtual column after showbreak
|
||||
long vcol_prev = -1; // "vcol" of previous character
|
||||
char_u *line; // current line
|
||||
char_u *ptr; // current position in "line"
|
||||
int row; // row in the window, excl w_winrow
|
||||
ScreenGrid *grid = &wp->w_grid; // grid specfic to the window
|
||||
int c = 0; // init for GCC
|
||||
long vcol = 0; // virtual column (for tabs)
|
||||
long vcol_sbr = -1; // virtual column after showbreak
|
||||
long vcol_prev = -1; // "vcol" of previous character
|
||||
char_u *line; // current line
|
||||
char_u *ptr; // current position in "line"
|
||||
int row; // row in the window, excl w_winrow
|
||||
ScreenGrid *grid = &wp->w_grid; // grid specfic to the window
|
||||
|
||||
char_u extra[18]; /* line number and 'fdc' must fit in here */
|
||||
int n_extra = 0; /* number of extra chars */
|
||||
char_u *p_extra = NULL; /* string of extra chars, plus NUL */
|
||||
char_u *p_extra_free = NULL; /* p_extra needs to be freed */
|
||||
int c_extra = NUL; /* extra chars, all the same */
|
||||
int extra_attr = 0; /* attributes when n_extra != 0 */
|
||||
static char_u *at_end_str = (char_u *)""; // used for p_extra when displaying
|
||||
// curwin->w_p_lcs_chars.eol at end-of-line
|
||||
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
|
||||
char_u extra[18]; // line number and 'fdc' must fit in here
|
||||
int n_extra = 0; // number of extra chars
|
||||
char_u *p_extra = NULL; // string of extra chars, plus NUL
|
||||
char_u *p_extra_free = NULL; // p_extra needs to be freed
|
||||
int c_extra = NUL; // extra chars, all the same
|
||||
int extra_attr = 0; // attributes when n_extra != 0
|
||||
static char_u *at_end_str = (char_u *)""; // used for p_extra when displaying
|
||||
// curwin->w_p_lcs_chars.eol at
|
||||
// end-of-line
|
||||
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) */
|
||||
int saved_n_extra = 0;
|
||||
@ -2792,11 +2792,12 @@ win_line (
|
||||
if (draw_state == WL_SBR - 1 && n_extra == 0) {
|
||||
draw_state = WL_SBR;
|
||||
if (filler_todo > 0) {
|
||||
/* Draw "deleted" diff line(s). */
|
||||
if (char2cells(wp->w_p_fcs_chars.diff) > 1)
|
||||
// draw "deleted" diff line(s)
|
||||
if (char2cells(wp->w_p_fcs_chars.diff) > 1) {
|
||||
c_extra = '-';
|
||||
else
|
||||
} else {
|
||||
c_extra = wp->w_p_fcs_chars.diff;
|
||||
}
|
||||
if (wp->w_p_rl) {
|
||||
n_extra = col + 1;
|
||||
} else {
|
||||
@ -3406,7 +3407,8 @@ win_line (
|
||||
&& (((c == 160
|
||||
|| (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
|
||||
&& 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;
|
||||
n_attr = 1;
|
||||
extra_attr = win_hl_attr(wp, HLF_0);
|
||||
@ -3467,7 +3469,8 @@ win_line (
|
||||
tab_len += vcol_off;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -3486,7 +3489,8 @@ win_line (
|
||||
for (i = 0; i < tab_len; i++) {
|
||||
utf_char2bytes(wp->w_p_lcs_chars.tab2, p);
|
||||
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;
|
||||
|
||||
@ -3511,7 +3515,8 @@ win_line (
|
||||
// Make sure, the highlighting for the tab char will be
|
||||
// correctly set further below (effectively reverts the
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@ -3858,7 +3863,8 @@ win_line (
|
||||
|
||||
// Make sure alignment is the same regardless
|
||||
// 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) {
|
||||
rightmost_vcol = wp->w_virtcol;
|
||||
@ -3978,7 +3984,7 @@ win_line (
|
||||
break;
|
||||
}
|
||||
|
||||
/* line continues beyond line end */
|
||||
// line continues beyond line end
|
||||
if (wp->w_p_lcs_chars.ext
|
||||
&& !wp->w_p_wrap
|
||||
&& filler_todo <= 0
|
||||
@ -4164,7 +4170,8 @@ win_line (
|
||||
if ((wp->w_p_rl ? (col < 0) : (col >= grid->Columns))
|
||||
&& (*ptr != NUL
|
||||
|| 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)))
|
||||
) {
|
||||
bool wrap = wp->w_p_wrap // Wrapping enabled.
|
||||
@ -4227,13 +4234,15 @@ win_line (
|
||||
saved_char_attr = char_attr;
|
||||
n_extra = 0;
|
||||
lcs_prec_todo = wp->w_p_lcs_chars.prec;
|
||||
if (filler_todo <= 0)
|
||||
need_showbreak = TRUE;
|
||||
--filler_todo;
|
||||
/* When the filler lines are actually below the last line of the
|
||||
* file, don't draw the line itself, break here. */
|
||||
if (filler_todo == 0 && wp->w_botfill)
|
||||
if (filler_todo <= 0) {
|
||||
need_showbreak = true;
|
||||
}
|
||||
filler_todo--;
|
||||
// When the filler lines are actually below the last line of the
|
||||
// file, don't draw the line itself, break here.
|
||||
if (filler_todo == 0 && wp->w_botfill) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} /* for every character in the line */
|
||||
@ -7001,12 +7010,12 @@ static void win_redr_ruler(win_T *wp, int always)
|
||||
off = 0;
|
||||
}
|
||||
|
||||
/* In list mode virtcol needs to be recomputed */
|
||||
// In list mode virtcol needs to be recomputed
|
||||
colnr_T virtcol = wp->w_virtcol;
|
||||
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);
|
||||
wp->w_p_list = TRUE;
|
||||
wp->w_p_list = true;
|
||||
}
|
||||
|
||||
#define RULER_BUF_LEN 70
|
||||
|
Loading…
Reference in New Issue
Block a user