Fixes bug created in the [commit
ac4a400](ac4a400b25)
**Prevent crash when using plenary.window.float for floating window**
This MR fixes a bug caused by inconsistent return values from
get_window_pos() when vim.g.lazygit_floating_window_use_plenary is
enabled.
**Problem**
When plenary.window.float is used, get_window_pos() returned (win_id,
bufnr) instead of the expected (width, height, row, col). This led to a
runtime error:
E5108: Error executing lua ...window.lua:33: attempt to perform
arithmetic on local 'row' (a nil value)
**Solution**
Ensure that get_window_pos() always returns consistent values and
explicitly handle the Plenary case in open_floating_window().
This prevents arithmetic operations on nil values and restores
compatibility with the Plenary-based layout logic.
**Tested**
- Works correctly with and without
vim.g.lazygit_floating_window_use_plenary set.
- No runtime errors on window resize or open.
- Borders and buffer correctly positioned in both modes.
Co-authored-by: abezlyudniy <abezlyudniy@ozon.ru>
Fixes#116https://github.com/kdheepak/lazygit.nvim/assets/167217/729c203a-c873-45c8-8346-cd7266d9eb2f
The `defer` is a bit of a hack, but otherwise the new size doesn't get
enough time to be properly registered. It still sometimes messes up and
positions itself slightly off sometimes if I try to do it several times
fast, so maybe the delay needs to be adjusted, some debounce added, or
we might want to find a different method for ensuring the window has the
correct size.
Co-authored-by: Chen Asraf <chenasraf@users.noreply.github.com>
The `vim.loop` prop is deprecated and will be removed at Nvim 1.0. This
PR adds support for the new `vim.uv` prop instead but keeps backward
compatibility with previous versions of Nvim.
signcolumns hide the left borders(for configs that have the signcolumn
opt active. Requires to be set twice(this may be a personal config
scenario). The first sets for the floating window created, the second
for lazygit's UI.
If a user is on windows, and is using powershell as the default nvim
shell the command at [line 69 of
utils.lua](https://github.com/lucaSartore/lazygit.nvim/blob/main/lua/lazygit/utils.lua#L67C2-L67C130)
won’t work due to the `&&` operator.
> local cmd = string.format('cd "%s" && git rev-parse --show-toplevel',
fn.fnamemodify(fn.resolve(fn.expand('%:p')), ':h'), root)
I fixed this by forcing the use of cmd.
There is an existing user config for setting the winblend value of the
lazygit floating window. This controls the background transparency of
the window. However, this config option is not respected if the lazygit
window is created using plenary (another user config). This change
forces the plenary window to use the existing config for transparency.
Add `LazyGitBorder` and `LazyGitFloat` highlighting groups using nvim(>=0.7.2) function `vim.api.nvim_set_hl`.
Add full list of window border for useful customize.