Allow using internal popupmenu or ext_popupmenu for wildmenu

Deprecate ext_wildmenu. ext_popupmenu already contains more state (anchor
position), and will allow further expansion (info about items).
This commit is contained in:
Björn Linse
2019-03-04 10:59:44 +01:00
parent 175398f216
commit be8ebba325
19 changed files with 553 additions and 69 deletions

View File

@@ -555,6 +555,24 @@ size_t mb_string2cells(const char_u *str)
return clen;
}
/// Get the number of cells occupied by string `str` with maximum length `size`
///
/// @param str The source string, may not be NULL, must be a NUL-terminated
/// string.
/// @param size maximum length of string. It will terminate on earlier NUL.
/// @return The number of cells occupied by string `str`
size_t mb_string2cells_len(const char_u *str, size_t size)
{
size_t clen = 0;
for (const char_u *p = str; *p != NUL && p < str+size;
p += utf_ptr2len_len(p, size+(p-str))) {
clen += utf_ptr2cells(p);
}
return clen;
}
/// Convert a UTF-8 byte sequence to a wide character
///
/// If the sequence is illegal or truncated by a NUL then the first byte is