mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 19:06:31 +00:00
api: refactor FloatRelative usage
This commit is contained in:
@@ -1047,7 +1047,8 @@ Buffer nvim_create_buf(Boolean listed, Boolean scratch, Error *err)
|
||||
///
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return the window handle or 0 when error
|
||||
Window nvim_open_win(Buffer buffer, Boolean enter, Dictionary config, Error *err)
|
||||
Window nvim_open_win(Buffer buffer, Boolean enter, Dictionary config,
|
||||
Error *err)
|
||||
FUNC_API_SINCE(6)
|
||||
{
|
||||
FloatConfig fconfig = FLOAT_CONFIG_INIT;
|
||||
|
@@ -512,21 +512,9 @@ Dictionary nvim_win_get_config(Window window, Error *err)
|
||||
PUT(rv, "row", FLOAT_OBJ(wp->w_float_config.row));
|
||||
PUT(rv, "col", FLOAT_OBJ(wp->w_float_config.col));
|
||||
|
||||
if (wp->w_floating) {
|
||||
switch (wp->w_float_config.relative) {
|
||||
case kFloatRelativeEditor:
|
||||
PUT(rv, "relative", STRING_OBJ(cstr_to_string("editor")));
|
||||
break;
|
||||
case kFloatRelativeWindow:
|
||||
PUT(rv, "relative", STRING_OBJ(cstr_to_string("win")));
|
||||
break;
|
||||
case kFloatRelativeCursor:
|
||||
PUT(rv, "relative", STRING_OBJ(cstr_to_string("cursor")));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
PUT(rv, "relative", STRING_OBJ(cstr_to_string("")));
|
||||
}
|
||||
const char *rel =
|
||||
wp->w_floating ? float_relative_str[wp->w_float_config.relative] : "";
|
||||
PUT(rv, "relative", STRING_OBJ(cstr_to_string(rel)));
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
Reference in New Issue
Block a user