mirror of
https://github.com/neovim/neovim.git
synced 2024-12-26 14:11:15 -07:00
fix(api/nvim_eval_statusline): allow maxwidth=0 #16080
Allows disabling statusline truncation by allowing maxwidth to be set to 0 in `nvim_eval_statusline`.
This commit is contained in:
parent
9fb0f12357
commit
da7a4684df
@ -2933,9 +2933,9 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
|
|||||||
{
|
{
|
||||||
Dictionary result = ARRAY_DICT_INIT;
|
Dictionary result = ARRAY_DICT_INIT;
|
||||||
|
|
||||||
Window window = 0;
|
int maxwidth;
|
||||||
int maxwidth = 0;
|
|
||||||
char fillchar = 0;
|
char fillchar = 0;
|
||||||
|
Window window = 0;
|
||||||
bool use_tabline = false;
|
bool use_tabline = false;
|
||||||
bool highlights = false;
|
bool highlights = false;
|
||||||
|
|
||||||
@ -2948,15 +2948,6 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
|
|||||||
window = (Window)opts->winid.data.integer;
|
window = (Window)opts->winid.data.integer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HAS_KEY(opts->maxwidth)) {
|
|
||||||
if (opts->maxwidth.type != kObjectTypeInteger) {
|
|
||||||
api_set_error(err, kErrorTypeValidation, "maxwidth must be an integer");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
maxwidth = (int)opts->maxwidth.data.integer;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HAS_KEY(opts->fillchar)) {
|
if (HAS_KEY(opts->fillchar)) {
|
||||||
if (opts->fillchar.type != kObjectTypeString || opts->fillchar.data.string.size > 1) {
|
if (opts->fillchar.type != kObjectTypeString || opts->fillchar.data.string.size > 1) {
|
||||||
api_set_error(err, kErrorTypeValidation, "fillchar must be an ASCII character");
|
api_set_error(err, kErrorTypeValidation, "fillchar must be an ASCII character");
|
||||||
@ -2998,7 +2989,14 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxwidth == 0) {
|
if (HAS_KEY(opts->maxwidth)) {
|
||||||
|
if (opts->maxwidth.type != kObjectTypeInteger) {
|
||||||
|
api_set_error(err, kErrorTypeValidation, "maxwidth must be an integer");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
maxwidth = (int)opts->maxwidth.data.integer;
|
||||||
|
} else {
|
||||||
maxwidth = use_tabline ? Columns : wp->w_width;
|
maxwidth = use_tabline ? Columns : wp->w_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user