mirror of https://github.com/sayanarijit/xplr
Optimize change directory performance
This PR breaks the custom layout renderer API by deprecating the following heavyweight fields in the Lua Context passed to the renderer functions. The following fields are being deprecated: - app.directory_buffer - app.history - app.last_modes However, there's no change in the Lua Context passed to the functions called via `CallLua*` messages. Closes: https://github.com/sayanarijit/xplr/issues/418pull/424/head
parent
e370c25bc5
commit
8f5e5491f2
@ -1,25 +0,0 @@
|
|||||||
-- Nothing to see here. Please move on.
|
|
||||||
-- Or if you insist, see https://github.com/sayanarijit/xplr/issues/412
|
|
||||||
|
|
||||||
local xplr = xplr
|
|
||||||
|
|
||||||
xplr.__CACHE__ = { directory_nodes = {} }
|
|
||||||
|
|
||||||
function xplr.__CACHE__.set_directory_nodes(nodes)
|
|
||||||
xplr.__CACHE__.directory_nodes = nodes
|
|
||||||
end
|
|
||||||
|
|
||||||
function xplr.__CACHE__.call(fun, arg)
|
|
||||||
if arg.app and arg.app.directory_buffer then
|
|
||||||
arg.app.directory_buffer.nodes = xplr.__CACHE__.directory_nodes
|
|
||||||
elseif arg.directory_buffer then
|
|
||||||
arg.directory_buffer.nodes = xplr.__CACHE__.directory_nodes
|
|
||||||
end
|
|
||||||
return fun(arg)
|
|
||||||
end
|
|
||||||
|
|
||||||
function xplr.__CACHE__.caller(fun)
|
|
||||||
return function(arg)
|
|
||||||
return xplr.__CACHE__.call(fun, arg)
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in New Issue