From 852769fb98e346e2b2c98808d3816ca4ecd20913 Mon Sep 17 00:00:00 2001 From: Giuseppe Gadola Date: Fri, 10 Feb 2023 17:38:05 +0100 Subject: refactor(popup): create popup directly inside the Pet class --- lua/pets/pet.lua | 16 ++++++++++++++++ lua/pets/popup.lua | 19 ------------------- 2 files changed, 16 insertions(+), 19 deletions(-) delete mode 100644 lua/pets/popup.lua (limited to 'lua/pets') 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 -- cgit v1.3-2-g11bf