feat(float): support toggle show float window

This commit is contained in:
glepnir
2023-09-27 17:23:42 +08:00
parent dfa8b582a6
commit 4200a0f167
9 changed files with 156 additions and 14 deletions

View File

@@ -113,6 +113,7 @@ typedef struct {
String style;
Boolean noautocmd;
Boolean fixed;
Boolean hide;
} Dict(float_config);
typedef struct {

View File

@@ -165,6 +165,7 @@
/// calling this function.
/// - fixed: If true when anchor is NW or SW, the float window
/// would be kept fixed even if the window would be truncated.
/// - hide: If true the floating window will be hidden.
///
/// @param[out] err Error details, if any
///
@@ -323,6 +324,7 @@ Dictionary nvim_win_get_config(Window window, Error *err)
PUT(rv, "focusable", BOOLEAN_OBJ(config->focusable));
PUT(rv, "external", BOOLEAN_OBJ(config->external));
PUT(rv, "hide", BOOLEAN_OBJ(config->hide));
if (wp->w_floating) {
PUT(rv, "width", INTEGER_OBJ(config->width));
@@ -848,6 +850,10 @@ static bool parse_float_config(Dict(float_config) *config, FloatConfig *fconfig,
fconfig->fixed = config->fixed;
}
if (HAS_KEY_X(config, hide)) {
fconfig->hide = config->hide;
}
return true;
#undef HAS_KEY_X
}