Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error width key must be a positive Integer #248

Closed
cheriimoya opened this issue Jul 3, 2024 · 3 comments · Fixed by #250
Closed

Error width key must be a positive Integer #248

cheriimoya opened this issue Jul 3, 2024 · 3 comments · Fixed by #250
Labels
bug Something isn't working

Comments

@cheriimoya
Copy link

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, {
@j-hui j-hui added the bug Something isn't working label Jul 6, 2024
@j-hui
Copy link
Owner

j-hui commented Jul 6, 2024

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.

@j-hui
Copy link
Owner

j-hui commented Jul 6, 2024

@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.

@cheriimoya
Copy link
Author

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:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants