j-hui / fidget.nvim

💫 Extensible UI for Neovim notifications and LSP progress messages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error width key must be a positive Integer

cheriimoya opened this issue · comments

Sometimes when resizing nvim running in a tmux pane, nvim hangs for a few (maybe 15-20) seconds and I get this error:

image

Afterwards, fidgets window position doesn't change and fidget is dead (doesn't display any new messages).

image

I am trying to run it for now with this patch

diff --git a/lua/fidget/notification/window.lua b/lua/fidget/notification/window.lua
index 430277c..4a5008b 100644
--- a/lua/fidget/notification/window.lua
+++ b/lua/fidget/notification/window.lua
@@ -336,6 +336,10 @@ function M.get_window(row, col, anchor, width, height)
     height = math.min(height, M.options.max_height)
   end

+  if width < 1 then
+    width = 1
+  end
+
   if state.window_id == nil or not vim.api.nvim_win_is_valid(state.window_id) then
     -- Create window to display notifications buffer, but don't enter (2nd param)
     state.window_id = vim.api.nvim_open_win(M.get_buffer(), false, {

Thanks for reporting this. The right way to handle this is probably to just close/not draw the window if the editor size is too small. I'll have to think a little more about how best to handle this.

@cheriimoya I'm not sure how exactly to reproduce your issue, but I did some funky stuff with tmux and things didn't break for me after this patch. Feel free to re-open if the issue persists.

Thanks for looking into this issue and writing a proper fix for it:)
I'll try to reproduce the issue, or maybe I'll just use your patch instead.
Thanks again:)