diff options
| author | Giuseppe Gadola <giusgadola@gmail.com> | 2023-02-10 17:38:05 +0100 |
|---|---|---|
| committer | Giuseppe Gadola <giusgadola@gmail.com> | 2023-02-10 17:38:05 +0100 |
| commit | 852769fb98e346e2b2c98808d3816ca4ecd20913 (patch) | |
| tree | 6dc99cc082122c4b582cae5e98691ac12bdcb3ff | |
| parent | feat(commands): added the list pets command (diff) | |
refactor(popup): create popup directly inside the Pet class
| -rw-r--r-- | lua/pets/pet.lua | 16 | ||||
| -rw-r--r-- | lua/pets/popup.lua | 19 |
2 files changed, 16 insertions, 19 deletions
diff --git a/lua/pets/pet.lua b/lua/pets/pet.lua index f0e6cfa..4f31792 100644 --- a/lua/pets/pet.lua +++ b/lua/pets/pet.lua @@ -2,6 +2,21 @@ local M = {} M.Pet = {} M.Pet.__index = M.Pet +local popup_opts = { + position = { + row = "100%", + col = "100%", + }, + size = { + width = "25%", + height = 10, + }, + focusable = false, + enter = false, + win_options = { + winblend = 100, + }, +} -- @param name the actual name for the pet -- @param type the species of the pet e.g. cat -- @param style the color/style of the pet e.g. brown @@ -17,6 +32,7 @@ function M.Pet.new(name, type, style) instance.animation = require("pets.animations").Animation.new(instance.sourcedir, type, style) instance.popup = require("pets.popup").popup + instance.popup = require("nui.popup")(popup_opts) return instance end diff --git a/lua/pets/popup.lua b/lua/pets/popup.lua deleted file mode 100644 index 9a1b3a4..0000000 --- a/lua/pets/popup.lua +++ /dev/null @@ -1,19 +0,0 @@ -local M = {} -local Popup = require("nui.popup") - -M.popup = Popup({ - position = { - row = "100%", - col = "100%", - }, - size = { - width = "25%", - height = 10, - }, - focusable = false, - enter = false, - win_options = { - winblend = 100, - }, -}) -return M |