akinsho / akinsho/git-conflict.nvim

Bug: nil error on moving to next conflict when first opening the conflict file

Đang mở
#91 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Lua
Star
1.4k
Fork
70
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### The problem 🐛
When I run `cn` my keymap for `GitConflictNextConflict` before pressing any key I get this error:
Screenshot 2024-07-09 at 00 09 40

https://github.com/akinsho/git-conflict.nvim/assets/43537864/8df10b2a-e193-4e5f-a7b3-51257461b71d

Here I try running `GitConflictNextConflict` without pressing any key it and the error gets triggered, if I open it again and press `j` and the `GitConflictNextConflict` it works as expected
### A quick fix 🩹
Change this to cover `match.position` being nil
https://github.com/akinsho/git-conflict.nvim/blob/45cde6f0acf26d0e4b64acfa45349dd1da01e577/lua/git-conflict.lua#L343
```lua
if not match or match.positions == nil then return end
```
This does not handle the main problem that a key must be pressed for the `visited_buffers[0].position` to not be nil. I can make a PR for the quick fix, but I have to look more into why `visited_buffers` does not work when no key is pressed

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.