mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 02:46:31 +00:00
anchor float to buffer position
vim-patch:8.1.1645: cannot use a popup window for a balloon
This commit is contained in:
@@ -1059,6 +1059,12 @@ fail:
|
||||
/// - "SE" south-east
|
||||
/// - `height`: window height (in character cells). Minimum of 1.
|
||||
/// - `width`: window width (in character cells). Minimum of 1.
|
||||
/// - 'bufpos': position float relative text inside the window `win` (only
|
||||
/// when relative="win"). Takes a tuple of [line, column] where
|
||||
/// both are zero-index. Note: `row` and `col` if present, still
|
||||
/// applies relative this positio. By default `row=1` and `col=0`
|
||||
/// is used (with default NW anchor), to make the float
|
||||
/// behave like a tooltip under the buffer text.
|
||||
/// - `row`: row position. Screen cell height are used as unit. Can be
|
||||
/// floating point.
|
||||
/// - `col`: column position. Screen cell width is used as unit. Can be
|
||||
|
@@ -503,25 +503,33 @@ Dictionary nvim_win_get_config(Window window, Error *err)
|
||||
return rv;
|
||||
}
|
||||
|
||||
PUT(rv, "focusable", BOOLEAN_OBJ(wp->w_float_config.focusable));
|
||||
PUT(rv, "external", BOOLEAN_OBJ(wp->w_float_config.external));
|
||||
FloatConfig *config = &wp->w_float_config;
|
||||
|
||||
PUT(rv, "focusable", BOOLEAN_OBJ(config->focusable));
|
||||
PUT(rv, "external", BOOLEAN_OBJ(config->external));
|
||||
|
||||
if (wp->w_floating) {
|
||||
PUT(rv, "width", INTEGER_OBJ(wp->w_float_config.width));
|
||||
PUT(rv, "height", INTEGER_OBJ(wp->w_float_config.height));
|
||||
if (!wp->w_float_config.external) {
|
||||
if (wp->w_float_config.relative == kFloatRelativeWindow) {
|
||||
PUT(rv, "win", INTEGER_OBJ(wp->w_float_config.window));
|
||||
PUT(rv, "width", INTEGER_OBJ(config->width));
|
||||
PUT(rv, "height", INTEGER_OBJ(config->height));
|
||||
if (!config->external) {
|
||||
if (config->relative == kFloatRelativeWindow) {
|
||||
PUT(rv, "win", INTEGER_OBJ(config->window));
|
||||
if (config->bufpos.lnum >= 0) {
|
||||
Array pos = ARRAY_DICT_INIT;
|
||||
ADD(pos, INTEGER_OBJ(config->bufpos.lnum));
|
||||
ADD(pos, INTEGER_OBJ(config->bufpos.col));
|
||||
PUT(rv, "bufpos", ARRAY_OBJ(pos));
|
||||
}
|
||||
}
|
||||
PUT(rv, "anchor", STRING_OBJ(cstr_to_string(
|
||||
float_anchor_str[wp->w_float_config.anchor])));
|
||||
PUT(rv, "row", FLOAT_OBJ(wp->w_float_config.row));
|
||||
PUT(rv, "col", FLOAT_OBJ(wp->w_float_config.col));
|
||||
float_anchor_str[config->anchor])));
|
||||
PUT(rv, "row", FLOAT_OBJ(config->row));
|
||||
PUT(rv, "col", FLOAT_OBJ(config->col));
|
||||
}
|
||||
}
|
||||
|
||||
const char *rel = (wp->w_floating && !wp->w_float_config.external
|
||||
? float_relative_str[wp->w_float_config.relative] : "");
|
||||
const char *rel = (wp->w_floating && !config->external
|
||||
? float_relative_str[config->relative] : "");
|
||||
PUT(rv, "relative", STRING_OBJ(cstr_to_string(rel)));
|
||||
|
||||
return rv;
|
||||
|
Reference in New Issue
Block a user