chrisgrieser / nvim-tinygit

A lightweight bundle of commands focussed on swift and streamlined git operations.
MIT License
154 stars 4 forks source link

[Bug]: Default max witdth for notify is nil, so it breaks commit command #6

Closed dansdantas closed 6 months ago

dansdantas commented 8 months ago

Bug Description

https://github.com/chrisgrieser/nvim-tinygit/blob/6b133f56d7b61a684db7ae2c9e199f306af4ca8c/lua/tinygit/commands/commit-and-amend.lua#L191-L198

When defining width for preview, if nvim-notify is installed it queries max_width attribute so it doesn't overflow. On default config max_width is set to nil, and even if set to nil by user, it breaks this function because it can't remove 2 from nil(not sure if was changed recently)

https://github.com/rcarriga/nvim-notify/blob/1576123bff3bed67bc673a3076e591abfe5d8ca9/lua/notify/config/init.lua#L20-L44

Relevant Screenshot

No response

To Reproduce

  1. Install both tinygit and nvim-notify
  2. call tinygit smartCommit function

neovim version

NVIM v0.10.0-dev-2037+ge09adfdcf
Build type: RelWithDebInfo
LuaJIT 2.1.1703358377
Run "nvim -V1 -v" for more info

Make sure you have done the following

chrisgrieser commented 8 months ago

thx, fixed

kevintraver commented 6 months ago

I am still seeing this issue with the latest version of both plugins.

chrisgrieser commented 6 months ago

@kevintraver works on my end, with and without the max_width config from nvim-notify.

Could you please post the error you are getting?

kevintraver commented 6 months ago

msg_show.emsg E5108: Error executing lua: .../nvim-tinygit/lua/tinygit/commands/commit-and-amend.lua:193: attempt to perform arithmetic on field 'max_width' (a function value)

If I set max_width in nvim-notify then I don't get the error.

chrisgrieser commented 6 months ago

That is very weird, I only ever get number or nil for max_width.

Can only guess that some nvim-notify setting makes the max_width a function to be dynamic. Anyway, should be fixed.

If not, please create a new issue with your full tinygit and nvim-notify config to investigate this properly.

kevintraver commented 6 months ago

Yes it does appear fixed now. Thanks!

kevintraver commented 6 months ago

Ok, just for reference, Im using LazyVim, which is where that setting is coming from:

https://github.com/LazyVim/LazyVim/blob/0107a1079be7fb92f7d5b7e2c40818f47cf425d9/lua/lazyvim/plugins/ui.lua#L21-L23

chrisgrieser commented 6 months ago

Oh I see, thanks!