mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +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:
@@ -1391,8 +1391,8 @@ void diff_win_options(win_T *wp, bool addbuf)
|
||||
}
|
||||
wp->w_p_fdm_save = xstrdup(wp->w_p_fdm);
|
||||
}
|
||||
set_option_direct_for(kOptFoldmethod, STATIC_CSTR_AS_OPTVAL("diff"), OPT_LOCAL, 0,
|
||||
kOptScopeWin, wp);
|
||||
set_option_direct_for(kOptFoldmethod, STATIC_CSTR_AS_OPTVAL("diff"),
|
||||
option_ctx_from(kOptScopeWin, wp), OPT_LOCAL, 0);
|
||||
|
||||
if (!wp->w_p_diff) {
|
||||
wp->w_p_fen_save = wp->w_p_fen;
|
||||
|
Reference in New Issue
Block a user