mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
vim-patch:9.1.0137: <Del> in cmdline mode doesn't delete composing chars (#27636)
Problem: <Del> in cmdline mode doesn't delete composing chars
Solution: Use mb_head_off() and mb_ptr2len() (zeertzjq)
closes: vim/vim#14095
ff2b79d239
This commit is contained in:
@@ -1884,6 +1884,20 @@ void mb_copy_char(const char **const fp, char **const tp)
|
||||
*fp += l;
|
||||
}
|
||||
|
||||
/// Return the offset from "p" to the first byte of a character. When "p" is
|
||||
/// at the start of a character 0 is returned, otherwise the offset to the next
|
||||
/// character. Can start anywhere in a stream of bytes.
|
||||
int mb_off_next(const char *base, const char *p)
|
||||
{
|
||||
int head_off = utf_head_off(base, p);
|
||||
|
||||
if (head_off == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return utfc_ptr2len(p - head_off) - head_off;
|
||||
}
|
||||
|
||||
/// Returns the offset in bytes from "p_in" to the first and one-past-end bytes
|
||||
/// of the codepoint it points to.
|
||||
/// "p_in" can point anywhere in a stream of bytes.
|
||||
|
Reference in New Issue
Block a user