Skip to content

Commit

Permalink
fix(ui): resize popup window with nvim resize (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
amitds1997 committed Apr 17, 2024
1 parent f4c6c5d commit fd0f74a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/remote-nvim/ui.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local event = require("nui.utils.autocmd").event
local M = {}

---Generate a floating window, given the window options, running the provided command
Expand All @@ -24,10 +25,14 @@ function M.float_term(cmd, exit_cb, popup_options)
popup:mount()

-- If we leave the buffer, we close the pop-up
popup:on("BufLeave", function()
popup:on(event.BufLeave, function()
popup:unmount()
end, { once = true })

popup:on(event.VimResized, function()
popup:update_layout()
end)

vim.fn.termopen(cmd, {
on_exit = function(_, exit_code)
-- We close the pop-up if we exit successfully
Expand Down
6 changes: 6 additions & 0 deletions lua/remote-nvim/ui/progressview.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local event = require("nui.utils.autocmd").event
local Deque = require("remote-nvim.structs.deque")
local NuiLine = require("nui.line")
local NuiTree = require("nui.tree")
Expand Down Expand Up @@ -96,6 +97,11 @@ function ProgressView:init()
}
---@diagnostic disable-next-line:param-type-mismatch
self.progress_view = Popup(self.progress_view_options)

self.progress_view:on(event.VimResized, function()
---@diagnostic disable-next-line:param-type-mismatch
self.progress_view:update_layout()
end)
end
self.help_pane_bufnr = vim.api.nvim_create_buf(false, true)
self.session_info_pane_bufnr = vim.api.nvim_create_buf(false, true)
Expand Down

0 comments on commit fd0f74a

Please sign in to comment.