Function xplr::lua::util::layout_replace

source ·
pub fn layout_replace<'a>(util: Table<'a>, lua: &Lua) -> Result<Table<'a>>
Expand description

Find the target layout in the given layout and replace it with the replacement layout, returning a new layout.

Type: function( layout:[Layout][4], target:[Layout][4], replacement:[Layout][4] ) -> layout:[Layout][4]

Example:

local layout = {
  Horizontal = {
    splits = {
      "Table",  -- Target
      "HelpMenu",
    },
    config = ...,
  }
}

xplr.util.layout_replace(layout, "Table", "Selection")
-- {
--   Horizontal = {
--     splits = {
--       "Selection",  -- Replacement
--       "HelpMenu",
--     },
--     config = ...
--   }
-- }