Skip to content

Commit

Permalink
fix(windows): reset using initial size
Browse files Browse the repository at this point in the history
See #237 an #236
  • Loading branch information
rcarriga committed Feb 14, 2023
1 parent cb623ef commit 4ac0b4b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions lua/dapui/windows/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ local function horizontal_layout(height, position, win_configs, buffers)
vim.cmd(index == 1 and open_cmd .. " " .. " split" or "vsplit")
return buffers[index]
end
local win_states = {}
for _, conf in ipairs(win_configs) do
win_states[#win_states + 1] = vim.tbl_extend("force", conf, { init_size = conf.size })
end

return WindowLayout({
layout_type = "horizontal",
area_state = { size = height, init_size = height },
win_states = win_configs,
win_states = win_states,
get_win_size = api.nvim_win_get_width,
get_area_size = api.nvim_win_get_height,
set_win_size = api.nvim_win_set_width,
Expand All @@ -38,10 +42,15 @@ local function vertical_layout(width, position, win_configs, buffers)
return buffers[index]
end

local win_states = {}
for _, conf in ipairs(win_configs) do
win_states[#win_states + 1] = vim.tbl_extend("force", conf, { init_size = conf.size })
end

return WindowLayout({
layout_type = "vertical",
area_state = { size = width, init_size = width },
win_states = win_configs,
win_states = win_states,
get_win_size = api.nvim_win_get_height,
get_area_size = api.nvim_win_get_width,
set_area_size = api.nvim_win_set_width,
Expand Down
2 changes: 1 addition & 1 deletion lua/dapui/windows/layout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ local util = require("dapui.util")
---@field open_index fun(index: number): fun(): integer
---@field get_win_size fun(win_id: integer): integer
---@field get_area_size fun(win_id: integer): integer
---@field set_win_size fun(win_id: integer, size: integer, total_size: integer)
---@field set_win_size fun(win_id: integer, size: integer)
---@field set_area_size fun(win_id: integer, size: integer)
--
---@field has_initial_open boolean
Expand Down

0 comments on commit 4ac0b4b

Please sign in to comment.