mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(api): do not re-apply win_config.style when missing
This commit is contained in:
parent
53f36806f1
commit
da979ae04b
@ -3066,8 +3066,8 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
|
|||||||
In general, values below 100 are recommended, unless
|
In general, values below 100 are recommended, unless
|
||||||
there is a good reason to overshadow builtin elements.
|
there is a good reason to overshadow builtin elements.
|
||||||
|
|
||||||
• style: Configure the appearance of the window. Currently
|
• style: (optional) Configure the appearance of the window.
|
||||||
only takes one non-empty value:
|
Currently only supports one value:
|
||||||
• "minimal" Nvim will display the window with many UI
|
• "minimal" Nvim will display the window with many UI
|
||||||
options disabled. This is useful when displaying a
|
options disabled. This is useful when displaying a
|
||||||
temporary float where the text should not be edited.
|
temporary float where the text should not be edited.
|
||||||
|
@ -108,8 +108,8 @@
|
|||||||
/// The default value for floats are 50. In general, values below 100 are
|
/// The default value for floats are 50. In general, values below 100 are
|
||||||
/// recommended, unless there is a good reason to overshadow builtin
|
/// recommended, unless there is a good reason to overshadow builtin
|
||||||
/// elements.
|
/// elements.
|
||||||
/// - style: Configure the appearance of the window. Currently only takes
|
/// - style: (optional) Configure the appearance of the window. Currently
|
||||||
/// one non-empty value:
|
/// only supports one value:
|
||||||
/// - "minimal" Nvim will display the window with many UI options
|
/// - "minimal" Nvim will display the window with many UI options
|
||||||
/// disabled. This is useful when displaying a temporary
|
/// disabled. This is useful when displaying a temporary
|
||||||
/// float where the text should not be edited. Disables
|
/// float where the text should not be edited. Disables
|
||||||
@ -222,9 +222,11 @@ void nvim_win_set_config(Window window, Dict(float_config) *config, Error *err)
|
|||||||
win_config_float(win, fconfig);
|
win_config_float(win, fconfig);
|
||||||
win->w_pos_changed = true;
|
win->w_pos_changed = true;
|
||||||
}
|
}
|
||||||
if (fconfig.style == kWinStyleMinimal) {
|
if (HAS_KEY(config->style)) {
|
||||||
win_set_minimal_style(win);
|
if (fconfig.style == kWinStyleMinimal) {
|
||||||
didset_window_options(win, true);
|
win_set_minimal_style(win);
|
||||||
|
didset_window_options(win, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,6 +432,25 @@ describe('float window', function()
|
|||||||
assert_alive()
|
assert_alive()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("should re-apply 'style' when present", function()
|
||||||
|
local float_opts = {style = 'minimal', relative = 'editor', row = 1, col = 1, width = 1, height = 1}
|
||||||
|
local float_win = meths.open_win(0, true, float_opts)
|
||||||
|
meths.win_set_option(float_win, 'number', true)
|
||||||
|
float_opts.row = 2
|
||||||
|
meths.win_set_config(float_win, float_opts)
|
||||||
|
eq(false, meths.win_get_option(float_win, 'number'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it("should not re-apply 'style' when missing", function()
|
||||||
|
local float_opts = {style = 'minimal', relative = 'editor', row = 1, col = 1, width = 1, height = 1}
|
||||||
|
local float_win = meths.open_win(0, true, float_opts)
|
||||||
|
meths.win_set_option(float_win, 'number', true)
|
||||||
|
float_opts.row = 2
|
||||||
|
float_opts.style = nil
|
||||||
|
meths.win_set_config(float_win, float_opts)
|
||||||
|
eq(true, meths.win_get_option(float_win, 'number'))
|
||||||
|
end)
|
||||||
|
|
||||||
it("'scroll' is computed correctly when opening float with splitkeep=screen #20684", function()
|
it("'scroll' is computed correctly when opening float with splitkeep=screen #20684", function()
|
||||||
meths.set_option('splitkeep', 'screen')
|
meths.set_option('splitkeep', 'screen')
|
||||||
local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10}
|
local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10}
|
||||||
|
Loading…
Reference in New Issue
Block a user