mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 19:18:34 +00:00
lint: clean-up after parent commits
This commit is contained in:
@@ -8656,7 +8656,7 @@ static char_u *do_insert_char_pre(int c)
|
|||||||
if (!has_event(EVENT_INSERTCHARPRE)) {
|
if (!has_event(EVENT_INSERTCHARPRE)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
buf[utf_char2bytes(c, (char_u *) buf)] = NUL;
|
buf[utf_char2bytes(c, (char_u *)buf)] = NUL;
|
||||||
|
|
||||||
// Lock the text to avoid weird things from happening.
|
// Lock the text to avoid weird things from happening.
|
||||||
textlock++;
|
textlock++;
|
||||||
|
@@ -4718,10 +4718,11 @@ static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
|
|||||||
++p;
|
++p;
|
||||||
/* For "\u" store the number according to
|
/* For "\u" store the number according to
|
||||||
* 'encoding'. */
|
* 'encoding'. */
|
||||||
if (c != 'X')
|
if (c != 'X') {
|
||||||
name += utf_char2bytes(nr, name);
|
name += utf_char2bytes(nr, name);
|
||||||
else
|
} else {
|
||||||
*name++ = nr;
|
*name++ = nr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -9477,8 +9478,9 @@ static void f_getchar(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
temp[i++] = K_SPECIAL;
|
temp[i++] = K_SPECIAL;
|
||||||
temp[i++] = K_SECOND(n);
|
temp[i++] = K_SECOND(n);
|
||||||
temp[i++] = K_THIRD(n);
|
temp[i++] = K_THIRD(n);
|
||||||
} else
|
} else {
|
||||||
i += utf_char2bytes(n, temp + i);
|
i += utf_char2bytes(n, temp + i);
|
||||||
|
}
|
||||||
temp[i++] = NUL;
|
temp[i++] = NUL;
|
||||||
rettv->v_type = VAR_STRING;
|
rettv->v_type = VAR_STRING;
|
||||||
rettv->vval.v_string = vim_strsave(temp);
|
rettv->vval.v_string = vim_strsave(temp);
|
||||||
@@ -18344,8 +18346,7 @@ void set_vim_var_char(int c)
|
|||||||
{
|
{
|
||||||
char buf[MB_MAXBYTES + 1];
|
char buf[MB_MAXBYTES + 1];
|
||||||
|
|
||||||
buf[utf_char2bytes(c, (char_u *) buf)] = NUL;
|
buf[utf_char2bytes(c, (char_u *)buf)] = NUL;
|
||||||
|
|
||||||
set_vim_var_string(VV_CHAR, buf, -1);
|
set_vim_var_string(VV_CHAR, buf, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1765,7 +1765,6 @@ static int command_line_handle_key(CommandLineState *s)
|
|||||||
s->j = utf_char2bytes(s->c, IObuff);
|
s->j = utf_char2bytes(s->c, IObuff);
|
||||||
IObuff[s->j] = NUL; // exclude composing chars
|
IObuff[s->j] = NUL; // exclude composing chars
|
||||||
put_on_cmdline(IObuff, s->j, true);
|
put_on_cmdline(IObuff, s->j, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
return command_line_changed(s);
|
return command_line_changed(s);
|
||||||
}
|
}
|
||||||
@@ -2369,10 +2368,10 @@ redraw:
|
|||||||
c1 = '?';
|
c1 = '?';
|
||||||
}
|
}
|
||||||
len = utf_char2bytes(c1, (char_u *)line_ga.ga_data + line_ga.ga_len);
|
len = utf_char2bytes(c1, (char_u *)line_ga.ga_data + line_ga.ga_len);
|
||||||
if (c1 == '\n')
|
if (c1 == '\n') {
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
else if (c1 == TAB) {
|
} else if (c1 == TAB) {
|
||||||
/* Don't use chartabsize(), 'ts' can be different */
|
// Don't use chartabsize(), 'ts' can be different.
|
||||||
do {
|
do {
|
||||||
msg_putchar(' ');
|
msg_putchar(' ');
|
||||||
} while (++vcol % 8);
|
} while (++vcol % 8);
|
||||||
@@ -2891,9 +2890,9 @@ static void draw_cmdline(int start, int len)
|
|||||||
newlen += utf_char2bytes(u8c, arshape_buf + newlen);
|
newlen += utf_char2bytes(u8c, arshape_buf + newlen);
|
||||||
if (u8cc[0] != 0) {
|
if (u8cc[0] != 0) {
|
||||||
newlen += utf_char2bytes(u8cc[0], arshape_buf + newlen);
|
newlen += utf_char2bytes(u8cc[0], arshape_buf + newlen);
|
||||||
if (u8cc[1] != 0)
|
if (u8cc[1] != 0) {
|
||||||
newlen += utf_char2bytes(u8cc[1],
|
newlen += utf_char2bytes(u8cc[1], arshape_buf + newlen);
|
||||||
arshape_buf + newlen);
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
prev_c = u8c;
|
prev_c = u8c;
|
||||||
|
@@ -3655,11 +3655,13 @@ int check_abbr(int c, char_u *ptr, int col, int mincol)
|
|||||||
tb[j++] = (char_u)K_SECOND(c);
|
tb[j++] = (char_u)K_SECOND(c);
|
||||||
tb[j++] = (char_u)K_THIRD(c);
|
tb[j++] = (char_u)K_THIRD(c);
|
||||||
} else {
|
} else {
|
||||||
if (c < ABBR_OFF && (c < ' ' || c > '~'))
|
if (c < ABBR_OFF && (c < ' ' || c > '~')) {
|
||||||
tb[j++] = Ctrl_V; /* special char needs CTRL-V */
|
tb[j++] = Ctrl_V; // special char needs CTRL-V
|
||||||
/* if ABBR_OFF has been added, remove it here */
|
}
|
||||||
if (c >= ABBR_OFF)
|
// if ABBR_OFF has been added, remove it here.
|
||||||
|
if (c >= ABBR_OFF) {
|
||||||
c -= ABBR_OFF;
|
c -= ABBR_OFF;
|
||||||
|
}
|
||||||
j += utf_char2bytes(c, tb + j);
|
j += utf_char2bytes(c, tb + j);
|
||||||
}
|
}
|
||||||
tb[j] = NUL;
|
tb[j] = NUL;
|
||||||
|
@@ -462,14 +462,13 @@ char_u *get_special_key_name(int c, int modifiers)
|
|||||||
string[idx++] = '_';
|
string[idx++] = '_';
|
||||||
string[idx++] = (char_u)KEY2TERMCAP0(c);
|
string[idx++] = (char_u)KEY2TERMCAP0(c);
|
||||||
string[idx++] = KEY2TERMCAP1(c);
|
string[idx++] = KEY2TERMCAP1(c);
|
||||||
}
|
} else {
|
||||||
/* Not a special key, only modifiers, output directly */
|
// Not a special key, only modifiers, output directly.
|
||||||
else {
|
if (utf_char2len(c) > 1) {
|
||||||
if (utf_char2len(c) > 1)
|
|
||||||
idx += utf_char2bytes(c, string + idx);
|
idx += utf_char2bytes(c, string + idx);
|
||||||
else if (vim_isprintc(c))
|
} else if (vim_isprintc(c)) {
|
||||||
string[idx++] = (char_u)c;
|
string[idx++] = (char_u)c;
|
||||||
else {
|
} else {
|
||||||
s = transchar(c);
|
s = transchar(c);
|
||||||
while (*s)
|
while (*s)
|
||||||
string[idx++] = *s++;
|
string[idx++] = *s++;
|
||||||
|
@@ -2538,10 +2538,11 @@ static void regc(int b)
|
|||||||
*/
|
*/
|
||||||
static void regmbc(int c)
|
static void regmbc(int c)
|
||||||
{
|
{
|
||||||
if (regcode == JUST_CALC_SIZE)
|
if (regcode == JUST_CALC_SIZE) {
|
||||||
regsize += utf_char2len(c);
|
regsize += utf_char2len(c);
|
||||||
else
|
} else {
|
||||||
regcode += utf_char2bytes(c, regcode);
|
regcode += utf_char2bytes(c, regcode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -6757,22 +6758,23 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
|
|||||||
cc = c;
|
cc = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
int totlen = utfc_ptr2len(src - 1);
|
int totlen = utfc_ptr2len(src - 1);
|
||||||
|
|
||||||
if (copy)
|
if (copy) {
|
||||||
utf_char2bytes(cc, dst);
|
utf_char2bytes(cc, dst);
|
||||||
dst += utf_char2len(cc) - 1;
|
}
|
||||||
int clen = utf_ptr2len(src - 1);
|
dst += utf_char2len(cc) - 1;
|
||||||
|
int clen = utf_ptr2len(src - 1);
|
||||||
|
|
||||||
/* If the character length is shorter than "totlen", there
|
// If the character length is shorter than "totlen", there
|
||||||
* are composing characters; copy them as-is. */
|
// are composing characters; copy them as-is.
|
||||||
if (clen < totlen) {
|
if (clen < totlen) {
|
||||||
if (copy)
|
if (copy) {
|
||||||
memmove(dst + 1, src - 1 + clen,
|
memmove(dst + 1, src - 1 + clen, (size_t)(totlen - clen));
|
||||||
(size_t)(totlen - clen));
|
|
||||||
dst += totlen - clen;
|
|
||||||
}
|
}
|
||||||
src += totlen - 1;
|
dst += totlen - clen;
|
||||||
|
}
|
||||||
|
src += totlen - 1;
|
||||||
dst++;
|
dst++;
|
||||||
} else {
|
} else {
|
||||||
if (REG_MULTI) {
|
if (REG_MULTI) {
|
||||||
@@ -6849,20 +6851,19 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
|
|||||||
if (has_mbyte) {
|
if (has_mbyte) {
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
/* Copy composing characters separately, one
|
// Copy composing characters separately, one
|
||||||
* at a time. */
|
// at a time.
|
||||||
if (enc_utf8)
|
l = utf_ptr2len(s) - 1;
|
||||||
l = utf_ptr2len(s) - 1;
|
|
||||||
else
|
|
||||||
l = utfc_ptr2len(s) - 1;
|
|
||||||
|
|
||||||
s += l;
|
s += l;
|
||||||
len -= l;
|
len -= l;
|
||||||
if (copy)
|
if (copy) {
|
||||||
utf_char2bytes(cc, dst);
|
utf_char2bytes(cc, dst);
|
||||||
|
}
|
||||||
dst += utf_char2len(cc) - 1;
|
dst += utf_char2len(cc) - 1;
|
||||||
} else if (copy)
|
} else if (copy) {
|
||||||
*dst = cc;
|
*dst = cc;
|
||||||
|
}
|
||||||
dst++;
|
dst++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5121,7 +5121,7 @@ win_redr_custom (
|
|||||||
/* fill up with "fillchar" */
|
/* fill up with "fillchar" */
|
||||||
while (width < maxwidth && len < (int)sizeof(buf) - 1) {
|
while (width < maxwidth && len < (int)sizeof(buf) - 1) {
|
||||||
len += utf_char2bytes(fillchar, buf + len);
|
len += utf_char2bytes(fillchar, buf + len);
|
||||||
++width;
|
width++;
|
||||||
}
|
}
|
||||||
buf[len] = NUL;
|
buf[len] = NUL;
|
||||||
|
|
||||||
@@ -6955,7 +6955,7 @@ static void win_redr_ruler(win_T *wp, int always)
|
|||||||
// Need at least 3 chars left for get_rel_pos() + NUL.
|
// Need at least 3 chars left for get_rel_pos() + NUL.
|
||||||
while (this_ru_col + o < width && RULER_BUF_LEN > i + 4) {
|
while (this_ru_col + o < width && RULER_BUF_LEN > i + 4) {
|
||||||
i += utf_char2bytes(fillchar, buffer + i);
|
i += utf_char2bytes(fillchar, buffer + i);
|
||||||
++o;
|
o++;
|
||||||
}
|
}
|
||||||
get_rel_pos(wp, buffer + i, RULER_BUF_LEN - i);
|
get_rel_pos(wp, buffer + i, RULER_BUF_LEN - i);
|
||||||
}
|
}
|
||||||
|
@@ -1378,9 +1378,12 @@ int searchc(cmdarg_T *cap, int t_cmd)
|
|||||||
set_csearch_until(t_cmd);
|
set_csearch_until(t_cmd);
|
||||||
lastc_bytelen = utf_char2bytes(c, lastc_bytes);
|
lastc_bytelen = utf_char2bytes(c, lastc_bytes);
|
||||||
if (cap->ncharC1 != 0) {
|
if (cap->ncharC1 != 0) {
|
||||||
lastc_bytelen += utf_char2bytes(cap->ncharC1, lastc_bytes + lastc_bytelen);
|
lastc_bytelen += utf_char2bytes(cap->ncharC1,
|
||||||
if (cap->ncharC2 != 0)
|
lastc_bytes + lastc_bytelen);
|
||||||
lastc_bytelen += utf_char2bytes(cap->ncharC2, lastc_bytes + lastc_bytelen);
|
if (cap->ncharC2 != 0) {
|
||||||
|
lastc_bytelen += utf_char2bytes(cap->ncharC2,
|
||||||
|
lastc_bytes + lastc_bytelen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // repeat previous search
|
} else { // repeat previous search
|
||||||
|
@@ -3461,8 +3461,9 @@ static void allcap_copy(char_u *word, char_u *wcopy)
|
|||||||
} else
|
} else
|
||||||
c = SPELL_TOUPPER(c);
|
c = SPELL_TOUPPER(c);
|
||||||
|
|
||||||
if (d - wcopy >= MAXWLEN - MB_MAXBYTES)
|
if (d - wcopy >= MAXWLEN - MB_MAXBYTES) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
d += utf_char2bytes(c, d);
|
d += utf_char2bytes(c, d);
|
||||||
}
|
}
|
||||||
*d = NUL;
|
*d = NUL;
|
||||||
@@ -4531,15 +4532,16 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
|
|||||||
#endif
|
#endif
|
||||||
PROF_STORE(sp->ts_state)
|
PROF_STORE(sp->ts_state)
|
||||||
sp->ts_state = STATE_UNSWAP;
|
sp->ts_state = STATE_UNSWAP;
|
||||||
++depth;
|
depth++;
|
||||||
fl = mb_char2len(c2);
|
fl = mb_char2len(c2);
|
||||||
memmove(p, p + n, fl);
|
memmove(p, p + n, fl);
|
||||||
utf_char2bytes(c, p + fl);
|
utf_char2bytes(c, p + fl);
|
||||||
stack[depth].ts_fidxtry = sp->ts_fidx + n + fl;
|
stack[depth].ts_fidxtry = sp->ts_fidx + n + fl;
|
||||||
} else
|
} else {
|
||||||
// If this swap doesn't work then SWAP3 won't either.
|
// If this swap doesn't work then SWAP3 won't either.
|
||||||
PROF_STORE(sp->ts_state)
|
PROF_STORE(sp->ts_state)
|
||||||
sp->ts_state = STATE_REP_INI;
|
sp->ts_state = STATE_REP_INI;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_UNSWAP:
|
case STATE_UNSWAP:
|
||||||
@@ -4586,7 +4588,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
|
|||||||
#endif
|
#endif
|
||||||
PROF_STORE(sp->ts_state)
|
PROF_STORE(sp->ts_state)
|
||||||
sp->ts_state = STATE_UNSWAP3;
|
sp->ts_state = STATE_UNSWAP3;
|
||||||
++depth;
|
depth++;
|
||||||
tl = mb_char2len(c3);
|
tl = mb_char2len(c3);
|
||||||
memmove(p, p + n + fl, tl);
|
memmove(p, p + n + fl, tl);
|
||||||
utf_char2bytes(c2, p + tl);
|
utf_char2bytes(c2, p + tl);
|
||||||
@@ -5895,8 +5897,9 @@ static void spell_soundfold_sofo(slang_T *slang, char_u *inword, char_u *res)
|
|||||||
|
|
||||||
if (c != NUL && c != prevc) {
|
if (c != NUL && c != prevc) {
|
||||||
ri += utf_char2bytes(c, res + ri);
|
ri += utf_char2bytes(c, res + ri);
|
||||||
if (ri + MB_MAXBYTES > MAXWLEN)
|
if (ri + MB_MAXBYTES > MAXWLEN) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
prevc = c;
|
prevc = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6416,10 +6419,11 @@ static void spell_soundfold_wsal(slang_T *slang, char_u *inword, char_u *res)
|
|||||||
|
|
||||||
// Convert wide characters in "wres" to a multi-byte string in "res".
|
// Convert wide characters in "wres" to a multi-byte string in "res".
|
||||||
l = 0;
|
l = 0;
|
||||||
for (n = 0; n < reslen; ++n) {
|
for (n = 0; n < reslen; n++) {
|
||||||
l += utf_char2bytes(wres[n], res + l);
|
l += utf_char2bytes(wres[n], res + l);
|
||||||
if (l + MB_MAXBYTES > MAXWLEN)
|
if (l + MB_MAXBYTES > MAXWLEN) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
res[l] = NUL;
|
res[l] = NUL;
|
||||||
}
|
}
|
||||||
|
@@ -1457,8 +1457,9 @@ static int read_compound(FILE *fd, slang_T *slang, int len)
|
|||||||
*pp++ = '|';
|
*pp++ = '|';
|
||||||
atstart = 1;
|
atstart = 1;
|
||||||
} else { // normal char, "[abc]" and '*' are copied as-is
|
} else { // normal char, "[abc]" and '*' are copied as-is
|
||||||
if (c == '?' || c == '+' || c == '~')
|
if (c == '?' || c == '+' || c == '~') {
|
||||||
*pp++ = '\\'; // "a?" becomes "a\?", "a+" becomes "a\+"
|
*pp++ = '\\'; // "a?" becomes "a\?", "a+" becomes "a\+"
|
||||||
|
}
|
||||||
pp += utf_char2bytes(c, pp);
|
pp += utf_char2bytes(c, pp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4241,7 +4242,7 @@ static int write_vim_spell(spellinfo_T *spin, char_u *fname)
|
|||||||
|
|
||||||
// Form the <folchars> string first, we need to know its length.
|
// Form the <folchars> string first, we need to know its length.
|
||||||
size_t l = 0;
|
size_t l = 0;
|
||||||
for (size_t i = 128; i < 256; ++i) {
|
for (size_t i = 128; i < 256; i++) {
|
||||||
l += (size_t)utf_char2bytes(spelltab.st_fold[i], folchars + l);
|
l += (size_t)utf_char2bytes(spelltab.st_fold[i], folchars + l);
|
||||||
}
|
}
|
||||||
put_bytes(fd, 1 + 128 + 2 + l, 4); // <sectionlen>
|
put_bytes(fd, 1 + 128 + 2 + l, 4); // <sectionlen>
|
||||||
|
Reference in New Issue
Block a user