mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
edit: Lint some functions which are to be copied for symbolic tests
This commit is contained in:
parent
6f22b5afad
commit
e423cfe194
@ -6074,27 +6074,30 @@ void free_last_insert(void)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Add character "c" to buffer "s". Escape the special meaning of K_SPECIAL
|
||||
* and CSI. Handle multi-byte characters.
|
||||
* Returns a pointer to after the added bytes.
|
||||
*/
|
||||
/// Add character "c" to buffer "s"
|
||||
///
|
||||
/// Escapes the special meaning of K_SPECIAL and CSI, handles multi-byte
|
||||
/// characters.
|
||||
///
|
||||
/// @param[in] c Character to add.
|
||||
/// @param[out] s Buffer to add to. Must have at least MB_MAXBYTES + 1 bytes.
|
||||
///
|
||||
/// @return Pointer to after the added bytes.
|
||||
char_u *add_char2buf(int c, char_u *s)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
char_u temp[MB_MAXBYTES + 1];
|
||||
int i;
|
||||
int len;
|
||||
|
||||
len = (*mb_char2bytes)(c, temp);
|
||||
for (i = 0; i < len; ++i) {
|
||||
const int len = utf_char2bytes(c, temp);
|
||||
for (int i = 0; i < len; ++i) {
|
||||
c = temp[i];
|
||||
/* Need to escape K_SPECIAL and CSI like in the typeahead buffer. */
|
||||
// Need to escape K_SPECIAL and CSI like in the typeahead buffer.
|
||||
if (c == K_SPECIAL) {
|
||||
*s++ = K_SPECIAL;
|
||||
*s++ = KS_SPECIAL;
|
||||
*s++ = KE_FILLER;
|
||||
} else
|
||||
} else {
|
||||
*s++ = c;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user