diff options
| author | Giuseppe Gadola <giusgadola@gmail.com> | 2023-02-24 11:16:14 +0100 |
|---|---|---|
| committer | Giuseppe Gadola <giusgadola@gmail.com> | 2023-02-24 11:28:21 +0100 |
| commit | 3ec7e3094e28b45831f58a414c91c780f7cbfa53 (patch) | |
| tree | e0b9245e67fa6ec4afa0aed8fd05564d4f657d9e | |
| parent | chore: add funding (diff) | |
fix: handle window/tab switches
Reload the popup when window/buffer is changed or there is any similar error.
Related to #17 and #19.
| -rw-r--r-- | lua/pets/animations.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lua/pets/animations.lua b/lua/pets/animations.lua index 1b9d93d..b413578 100644 --- a/lua/pets/animations.lua +++ b/lua/pets/animations.lua @@ -125,12 +125,17 @@ function M.Animation:next_frame() M.Animation.set_next_col(self) local ok = pcall(image.display, image, self.row, self.col, self.popup.bufnr, {}) if not ok then - require("pets").hidden = true self:stop() if self.popup then self.popup:unmount() end - utils.warning("Something went wrong, pets are hidden") + if self.current_image then + self.current_image:delete() + end + if not self.hidden then + self.popup:mount() + self:start() + end end self.current_image = image end |