mirror of
https://github.com/neovim/neovim.git
synced 2025-10-15 14:26:07 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user