Compare commits

...

2 commits
0.x ... fix/8

Author SHA1 Message Date
9e4f6633d2 fix: ensure the correct window is activated on complete
When you complete a completion the completion window is no longer
activated after the callback is run. This was causing issues with the
incorrect window being active after the completion.

This will lead the way for more actions other then edit, that will be
comming soon.

Fixes-issue: #8
2022-09-04 15:22:11 +01:00
683ce58652 test: add base test for ivy.window 2022-09-04 14:01:02 +01:00
2 changed files with 33 additions and 1 deletions

View file

@ -37,7 +37,9 @@ controller.update = function(text)
end
controller.complete = function()
controller.checkpoint()
vim.api.nvim_set_current_win(window.origin)
controller.callback(window.get_current_selection())
controller.destroy()
end

30
lua/ivy/window_test.lua Normal file
View file

@ -0,0 +1,30 @@
local window = require "ivy.window"
before_each(function()
-- Mock the global vim functions we are using in the prompt
_G.vim = {
notify = function() end,
api = {
nvim_echo = function() end,
nvim_get_current_win = function()
return 10
end,
nvim_command = function() end,
nvim_win_get_buf = function()
return 10
end,
nvim_win_set_option = function() end,
nvim_buf_set_option = function() end,
nvim_buf_set_var = function() end,
nvim_buf_set_keymap = function() end,
},
}
end)
it("can initialize", function(t)
window.initialize()
if window.get_buffer() ~= 10 then
t.error("The windows buffer should be 10 found " .. window.get_buffer())
end
end)