mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 19:06:31 +00:00
feat(api): relax statusline fillchar width check
Treat fillchar as single-width even if it isn't.
This commit is contained in:
@@ -2241,7 +2241,7 @@ Array nvim_get_mark(String name, Dictionary opts, Error *err)
|
||||
/// - winid: (number) |window-ID| of the window to use as context for statusline.
|
||||
/// - maxwidth: (number) Maximum width of statusline.
|
||||
/// - fillchar: (string) Character to fill blank spaces in the statusline (see
|
||||
/// 'fillchars').
|
||||
/// 'fillchars'). Treated as single-width even if it isn't.
|
||||
/// - highlights: (boolean) Return highlight information.
|
||||
/// - use_tabline: (boolean) Evaluate tabline instead of statusline. When |TRUE|, {winid}
|
||||
/// is ignored.
|
||||
@@ -2277,11 +2277,12 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
|
||||
|
||||
if (HAS_KEY(opts->fillchar)) {
|
||||
if (opts->fillchar.type != kObjectTypeString || opts->fillchar.data.string.size == 0
|
||||
|| char2cells(fillchar = utf_ptr2char((char_u *)opts->fillchar.data.string.data)) != 1
|
||||
|| (size_t)utf_char2len(fillchar) != opts->fillchar.data.string.size) {
|
||||
api_set_error(err, kErrorTypeValidation, "fillchar must be a single-width character");
|
||||
|| ((size_t)utf_ptr2len((char_u *)opts->fillchar.data.string.data)
|
||||
!= opts->fillchar.data.string.size)) {
|
||||
api_set_error(err, kErrorTypeValidation, "fillchar must be a single character");
|
||||
return result;
|
||||
}
|
||||
fillchar = utf_ptr2char((char_u *)opts->fillchar.data.string.data);
|
||||
}
|
||||
|
||||
if (HAS_KEY(opts->highlights)) {
|
||||
|
Reference in New Issue
Block a user