fix: open integration when the window is small - #26
Conversation
|
@copilot resolve the merge conflicts in this pull request |
There was a problem hiding this comment.
🟡 Changes recommended
Boundary handling and swallowed resize errors remain unresolved.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes integration opening in narrow Neovim windows and adds regression coverage.
Changes:
- Guards narrow-window resizing and stack repositioning.
- Adds small-window and stack regression tests.
- Adds a narrow-window test configuration.
File summaries
| File | Summary |
|---|---|
tests/test_integrations.lua |
Adds integration layout regression tests. |
tests/scripts/init_with_zen_small.lua |
Configures the narrow-window test environment. |
lua/zen/init.lua |
Updates narrow-window resizing and stack repositioning. |
Review details
Suppressed comments (1)
lua/zen/init.lua:376
- This guard does not cover the min-width adjustment in the
BufWinEnter/FileTypecallback: when a configured integration hasmin_widthandvim.o.columns <= get_main_width(), that path still callsnvim_win_set_width(..., min_width). On a terminal narrower than the configured minimum, the requested width cannot fit and the integration can fail to open. Apply the small-window rule around that adjustment too, and keep a min-width regression case.
if vim.o.columns <= get_main_width() then
return
end
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| vim.api.nvim_create_autocmd("CursorMoved", { | ||
| -- TODO: use pattern for better perf | ||
| callback = function(args) | ||
| if vim.o.columns <= get_main_width() then |
| pcall(function() | ||
| if position == "top" then | ||
| vim.api.nvim_win_set_config(windows[1], { split = "above", win = -1 }) | ||
| for i = 2, #windows do | ||
| vim.api.nvim_win_set_config(windows[i], { split = "below", win = windows[i - 1] }) |
Co-authored-by: sand4rt <17591696+sand4rt@users.noreply.github.com>
Resolved in |
There was a problem hiding this comment.
🟡 Changes recommended
The functional fix described by the PR title is not included.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 1/2 changed files
- Comments generated: 1
- Review effort level: Lite
|
|
||
|
|
||
| for _, case in ipairs({ { name = "above", }, { name = "below", } }) do | ||
| for _, case in ipairs({ { name = "above" }, { name = "below" } }) do |
There was a problem hiding this comment.
🟡 Changes recommended
The small-window behavior remains unchanged and needs an implementation plus regression coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
tests/test_integrations.lua:134
- The PR is titled as a fix for opening integrations in a small window, but this change only removes whitespace and reformats the test-case table; it does not alter the integration-opening logic or add a small-window regression test. Please include the runtime fix and a focused test, or retitle this PR if it is intended to be formatting-only.
for _, case in ipairs({ { name = "above" }, { name = "below" } }) do
- Files reviewed: 1/2 changed files
- Comments generated: 1
- Review effort level: Lite
| --- @field filetype Filetype | ||
| --- @field min_width? number | ||
| --- @field replace? boolean | ||
| --- @field replace? boolean |
No description provided.