From 5d248d46f220db79be5c5cfdc29a6167766cee64 Mon Sep 17 00:00:00 2001 From: Giuseppe Gadola Date: Wed, 15 Feb 2023 13:21:16 +0100 Subject: chore: validate row option --- README.md | 7 ++----- lua/pets/pet.lua | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1c52cb5..c01a63b 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,6 @@ With lazy: { "giusgad/pets.nvim", dependencies = { "MunifTanjim/nui.nvim", "edluffy/hologram.nvim" }, - config = true, - opts = { - -- your options - } } ``` @@ -41,7 +37,7 @@ With lazy: This is the default configuration: ```lua { - row = 5, -- the row (height) to display the pet at + row = 5, -- the row (height) to display the pet at (must be at least 1) col = 0, -- the column to display the pet at (set to high number to have it stay still on the right side) speed_multiplier = 1, -- you can make your pet move faster/slower. If slower the animation will have lower fps. default_pet = "cat", -- the pet to use for the PetNew command @@ -82,6 +78,7 @@ and shares all of its limitations. Here are the most significant ones: ## ✔️ Roadmap - [ ] Handle window resizes - [ ] add more pets +- [ ] add an option to change the pet's size ## 👏 Credits diff --git a/lua/pets/pet.lua b/lua/pets/pet.lua index 2442eec..f045f70 100644 --- a/lua/pets/pet.lua +++ b/lua/pets/pet.lua @@ -42,6 +42,10 @@ end -- start the animation of the pet function M.Pet:animate() + if self.animation.row <= 0 then + vim.notify("Row must be 1 or greater. Check your config", vim.log.levels.ERROR) + return + end self.popup:mount() self.animation:start() end -- cgit v1.3-2-g11bf