Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33563
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lua/ivy/controller.lua b/lua/ivy/controller.lua
index 57b34fe..8412dce 100644
--- a/lua/ivy/controller.lua
+++ b/lua/ivy/controller.lua
@@ -1,56 +1,62 @@
local window = require "ivy.window"
local prompt = require "ivy.prompt"
local controller = {}
controller.items = nil
controller.callback = nil
controller.run = function(items, callback)
controller.callback = callback
controller.items = items
window.initialize()
+ window.set_items { "-- Loading ---" }
+
controller.input ""
end
controller.input = function(char)
prompt.input(char)
- window.set_items(controller.items(prompt.text()))
+ vim.schedule(function()
+ window.set_items(controller.items(prompt.text()))
+ end)
end
controller.search = function(value)
prompt.set(value)
- window.set_items(controller.items(prompt.text()))
+ vim.schedule(function()
+ window.set_items(controller.items(prompt.text()))
+ end)
end
controller.complete = function()
controller.checkpoint()
controller.destroy()
end
controller.checkpoint = function()
vim.api.nvim_set_current_win(window.previous)
controller.callback(window.get_current_selection())
vim.api.nvim_set_current_win(window.window)
end
controller.next = function()
window.index = window.index + 1
window.update()
end
controller.previous = function()
window.index = window.index - 1
window.update()
end
controller.destroy = function()
controller.items = nil
controller.callback = nil
window.destroy()
prompt.destroy()
end
return controller
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Dec 16, 7:54 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8981
Default Alt Text
(1 KB)
Attached To
Mode
R1 ivy.nvim
Attached
Detach File
Event Timeline
Log In to Comment