From 2a7d0ed6145bf3f8b139c2694563f460f829813a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 23 Dec 2024 05:43:52 -0800 Subject: refactor: iwyu #31637 Result of `make iwyu` (after some "fixups"). --- src/nvim/winfloat.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/winfloat.c') diff --git a/src/nvim/winfloat.c b/src/nvim/winfloat.c index b8a51d686d..3e791e2beb 100644 --- a/src/nvim/winfloat.c +++ b/src/nvim/winfloat.c @@ -10,7 +10,6 @@ #include "nvim/ascii_defs.h" #include "nvim/autocmd.h" #include "nvim/buffer_defs.h" -#include "nvim/decoration.h" #include "nvim/drawscreen.h" #include "nvim/errors.h" #include "nvim/globals.h" -- cgit From 6257270040bc5c61a489f7fb9d4102223c36cf89 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Fri, 8 Nov 2024 11:57:59 +0600 Subject: refactor(options): set option value for non-current context directly Problem: Currently, we use `switch_option_context` to temporarily switch the current option context before setting an option for a different buffer / window. This is not ideal because we already support getting and setting option values for non-current contexts in the underlying implementation. Solution: Set option value for non-current context by passing the context directly to the lower level functions. Also introduce a new `OptCtx` struct to store option context information, this will scale much better if we add more option scopes and other context information in the future. --- src/nvim/winfloat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/winfloat.c') diff --git a/src/nvim/winfloat.c b/src/nvim/winfloat.c index 3e791e2beb..78f3551087 100644 --- a/src/nvim/winfloat.c +++ b/src/nvim/winfloat.c @@ -411,8 +411,8 @@ win_T *win_float_create(bool enter, bool new_buf) return handle_error_and_cleanup(wp, &err); } buf->b_p_bl = false; // unlist - set_option_direct_for(kOptBufhidden, STATIC_CSTR_AS_OPTVAL("wipe"), OPT_LOCAL, 0, - kOptScopeBuf, buf); + set_option_direct_for(kOptBufhidden, STATIC_CSTR_AS_OPTVAL("wipe"), + option_ctx_from(kOptScopeBuf, buf), OPT_LOCAL, 0); win_set_buf(wp, buf, &err); if (ERROR_SET(&err)) { return handle_error_and_cleanup(wp, &err); -- cgit From 19c9572d3626cde8503ee9061fa334b73f257b03 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 9 Jan 2025 12:32:25 +0800 Subject: Revert "refactor(options): set option value for non-current context directly" (#31924) Reverts #31112 --- src/nvim/winfloat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/winfloat.c') diff --git a/src/nvim/winfloat.c b/src/nvim/winfloat.c index 78f3551087..3e791e2beb 100644 --- a/src/nvim/winfloat.c +++ b/src/nvim/winfloat.c @@ -411,8 +411,8 @@ win_T *win_float_create(bool enter, bool new_buf) return handle_error_and_cleanup(wp, &err); } buf->b_p_bl = false; // unlist - set_option_direct_for(kOptBufhidden, STATIC_CSTR_AS_OPTVAL("wipe"), - option_ctx_from(kOptScopeBuf, buf), OPT_LOCAL, 0); + set_option_direct_for(kOptBufhidden, STATIC_CSTR_AS_OPTVAL("wipe"), OPT_LOCAL, 0, + kOptScopeBuf, buf); win_set_buf(wp, buf, &err); if (ERROR_SET(&err)) { return handle_error_and_cleanup(wp, &err); -- cgit From 25d8c3a5ad7e9c5668841e66540ebe34ceda73a7 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Tue, 14 Jan 2025 14:02:46 +0100 Subject: feat(api): nvim_open_win() relative to tabline and laststatus #32006 Problem: Anchoring a floating window to the tabline and laststatus is cumbersome; requiring autocommands and looping over all windows/tabpages. Solution: Add new "tabline" and "laststatus" options to the `relative` field of nvim_open_win() to place a window relative to. --- src/nvim/winfloat.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/winfloat.c') diff --git a/src/nvim/winfloat.c b/src/nvim/winfloat.c index 3e791e2beb..d11b965dfc 100644 --- a/src/nvim/winfloat.c +++ b/src/nvim/winfloat.c @@ -307,6 +307,15 @@ void win_check_anchored_floats(win_T *win) } } +void win_float_anchor_laststatus(void) +{ + FOR_ALL_WINDOWS_IN_TAB(win, curtab) { + if (win->w_config.relative == kFloatRelativeLaststatus) { + win->w_pos_changed = true; + } + } +} + void win_reconfig_floats(void) { for (win_T *wp = lastwin; wp && wp->w_floating; wp = wp->w_prev) { -- cgit