diff options
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r-- | src/nvim/api/vim.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 86dc0dd24b..b5cc02e761 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -2964,9 +2964,9 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error * { Dictionary result = ARRAY_DICT_INIT; - Window window = 0; - int maxwidth = 0; + int maxwidth; char fillchar = 0; + Window window = 0; bool use_tabline = false; bool highlights = false; @@ -2979,15 +2979,6 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error * 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 (opts->fillchar.type != kObjectTypeString || opts->fillchar.data.string.size > 1) { api_set_error(err, kErrorTypeValidation, "fillchar must be an ASCII character"); @@ -3029,7 +3020,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; } |