mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
remove !has_mbyte branches
Ref: https://github.com/neovim/neovim/pull/10171#discussion_r292437832
This commit is contained in:
parent
0e3b9ea74d
commit
e269c1028b
@ -503,21 +503,15 @@ void ins_bytes(char_u *p)
|
|||||||
/// Handles Replace mode and multi-byte characters.
|
/// Handles Replace mode and multi-byte characters.
|
||||||
void ins_bytes_len(char_u *p, size_t len)
|
void ins_bytes_len(char_u *p, size_t len)
|
||||||
{
|
{
|
||||||
if (has_mbyte) {
|
size_t n;
|
||||||
size_t n;
|
for (size_t i = 0; i < len; i += n) {
|
||||||
for (size_t i = 0; i < len; i += n) {
|
if (enc_utf8) {
|
||||||
if (enc_utf8) {
|
// avoid reading past p[len]
|
||||||
// avoid reading past p[len]
|
n = (size_t)utfc_ptr2len_len(p + i, (int)(len - i));
|
||||||
n = (size_t)utfc_ptr2len_len(p + i, (int)(len - i));
|
} else {
|
||||||
} else {
|
n = (size_t)(*mb_ptr2len)(p + i);
|
||||||
n = (size_t)(*mb_ptr2len)(p + i);
|
|
||||||
}
|
|
||||||
ins_char_bytes(p + i, n);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (size_t i = 0; i < len; i++) {
|
|
||||||
ins_char(p[i]);
|
|
||||||
}
|
}
|
||||||
|
ins_char_bytes(p + i, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -597,11 +591,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
|
|||||||
// first (it tells the byte length of the character).
|
// first (it tells the byte length of the character).
|
||||||
replace_push(NUL);
|
replace_push(NUL);
|
||||||
for (size_t i = 0; i < oldlen; i++) {
|
for (size_t i = 0; i < oldlen; i++) {
|
||||||
if (has_mbyte) {
|
i += (size_t)replace_push_mb(oldp + col + i) - 1;
|
||||||
i += (size_t)replace_push_mb(oldp + col + i) - 1;
|
|
||||||
} else {
|
|
||||||
replace_push(oldp[col + i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,15 +678,12 @@ void ins_str(char_u *s)
|
|||||||
// return FAIL for failure, OK otherwise
|
// return FAIL for failure, OK otherwise
|
||||||
int del_char(bool fixpos)
|
int del_char(bool fixpos)
|
||||||
{
|
{
|
||||||
if (has_mbyte) {
|
// Make sure the cursor is at the start of a character.
|
||||||
// Make sure the cursor is at the start of a character.
|
mb_adjust_cursor();
|
||||||
mb_adjust_cursor();
|
if (*get_cursor_pos_ptr() == NUL) {
|
||||||
if (*get_cursor_pos_ptr() == NUL) {
|
return FAIL;
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
return del_chars(1L, fixpos);
|
|
||||||
}
|
}
|
||||||
return del_bytes(1, fixpos, true);
|
return del_chars(1L, fixpos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Like del_bytes(), but delete characters instead of bytes.
|
/// Like del_bytes(), but delete characters instead of bytes.
|
||||||
@ -983,11 +970,7 @@ int open_line(
|
|||||||
replace_push(NUL);
|
replace_push(NUL);
|
||||||
p = saved_line + curwin->w_cursor.col;
|
p = saved_line + curwin->w_cursor.col;
|
||||||
while (*p != NUL) {
|
while (*p != NUL) {
|
||||||
if (has_mbyte) {
|
p += replace_push_mb(p);
|
||||||
p += replace_push_mb(p);
|
|
||||||
} else {
|
|
||||||
replace_push(*p++);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
saved_line[curwin->w_cursor.col] = NUL;
|
saved_line[curwin->w_cursor.col] = NUL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user