Repository navigation
fix: resizing with top/bottom integrations #6
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,14 @@ | ||
| { | ||
| "diagnostics": { | ||
| "globals": [ | ||
| "dofile" | ||
| "dofile", | ||
| "MiniTest" | ||
| ] | ||
| }, | ||
| "workspace": { | ||
| "library": [ | ||
| "$VIMRUNTIME", | ||
| "deps/mini.nvim" | ||
| "deps/pack/testing/start/mini.nvim" | ||
| ] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,41 @@ | ||
| DEPS_DIR := $(CURDIR)/deps | ||
| START_DIR := $(DEPS_DIR)/pack/testing/start | ||
|
|
||
| .PHONY: test deps | ||
|
|
||
| # Download mini.nvim if not present, then run all tests | ||
| test: deps | ||
| nvim --headless -u tests/scripts/minimal_init.lua -c "lua MiniTest.run()" | ||
|
|
||
| # Clone mini.nvim into deps/ | ||
| deps: | ||
| @if [ ! -d "$(DEPS_DIR)/mini.nvim" ]; then \ | ||
| echo "Downloading mini.nvim..."; \ | ||
| mkdir -p "$(DEPS_DIR)"; \ | ||
| git clone --depth 1 https://github.com/echasnovski/mini.nvim "$(DEPS_DIR)/mini.nvim"; \ | ||
| fi | ||
| deps: \ | ||
| $(START_DIR)/mini.nvim \ | ||
| $(START_DIR)/vim-fugitive \ | ||
| $(START_DIR)/fyler.nvim \ | ||
| $(START_DIR)/trouble.nvim \ | ||
| $(START_DIR)/neotest \ | ||
| $(START_DIR)/nvim-nio \ | ||
| $(START_DIR)/plenary.nvim \ | ||
| $(START_DIR)/fixcursorhold | ||
|
|
||
| $(START_DIR)/mini.nvim: | ||
| git clone --depth 1 https://github.com/echasnovski/mini.nvim $@ | ||
|
|
||
| $(START_DIR)/vim-fugitive: | ||
| git clone --depth 1 https://github.com/tpope/vim-fugitive $@ | ||
|
|
||
| $(START_DIR)/fyler.nvim: | ||
| git clone --depth 1 https://github.com/A7Lavinraj/fyler.nvim $@ | ||
|
|
||
| $(START_DIR)/trouble.nvim: | ||
| git clone --depth 1 https://github.com/folke/trouble.nvim $@ | ||
|
|
||
| $(START_DIR)/neotest: | ||
| git clone --depth 1 https://github.com/nvim-neotest/neotest $@ | ||
|
|
||
| $(START_DIR)/nvim-nio: | ||
| git clone --depth 1 https://github.com/nvim-neotest/nvim-nio $@ | ||
|
|
||
| $(START_DIR)/plenary.nvim: | ||
| git clone --depth 1 https://github.com/nvim-lua/plenary.nvim $@ | ||
|
|
||
| $(START_DIR)/fixcursorhold: | ||
| git clone --depth 1 https://github.com/antoinemadec/FixCursorHold.nvim $@ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,24 @@ | ||
| vim.cmd([[let &rtp.=','.getcwd()]]) | ||
| vim.cmd("set rtp+=deps/mini.nvim") | ||
| vim.opt.packpath:prepend("deps") | ||
|
|
||
| vim.o.columns = 240 | ||
| vim.o.lines = 52 | ||
|
|
||
| require("mini.test").setup() | ||
| require("zen").setup() | ||
| require("trouble").setup({ open_no_results = true }) | ||
| require("zen").setup({ | ||
|
Comment on lines
1
to
+9
|
||
| top = { | ||
| { filetype = "fugitive" }, | ||
| }, | ||
| bottom = { | ||
| { filetype = "trouble" }, | ||
| }, | ||
| left = { | ||
| min_width = 46, | ||
| { filetype = "fyler" }, | ||
| }, | ||
| right = { | ||
| min_width = 46, | ||
| { filetype = "neotest-summary" }, | ||
| }, | ||
| }) | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||
| vim.cmd([[let &rtp.=','.getcwd()]]) | ||||||||
| vim.cmd("set rtp+=deps/mini.nvim") | ||||||||
| vim.opt.packpath:prepend("deps") | ||||||||
|
||||||||
| vim.opt.packpath:prepend("deps") | |
| vim.opt.packpath:prepend("deps") | |
| vim.cmd([[packadd mini.nvim]]) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| local Helpers = dofile("tests/scripts/helpers.lua") | ||
| local child = MiniTest.new_child_neovim() | ||
|
|
||
| local T = MiniTest.new_set({ | ||
| hooks = { | ||
| pre_case = function() | ||
| child.restart({ "-u", "tests/scripts/init_with_zen.lua" }) | ||
| end, | ||
| post_once = child.stop, | ||
| }, | ||
| }) | ||
|
|
||
| T["resizing below minimum width closes the side buffers"] = function() | ||
| child.cmd("set columns-=100") | ||
| child.cmd("doautocmd VimResized") | ||
|
|
||
| Helpers.expect.layout(child, { | ||
| type = "leaf", | ||
| filetype = "", | ||
| buftype = "", | ||
| width = 140, | ||
| height = 50, | ||
| }) | ||
| end | ||
|
|
||
| T["resizing above minimum width reopens the side buffers"] = function() | ||
| child.cmd("set columns-=100") | ||
| child.cmd("doautocmd VimResized") | ||
|
|
||
| child.cmd("set columns+=100") | ||
| child.cmd("doautocmd VimResized") | ||
|
|
||
| Helpers.expect.layout(child, { | ||
| type = "row", | ||
| children = { | ||
| { type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 50 }, | ||
| { type = "leaf", filetype = "", buftype = "", width = 146, height = 50 }, | ||
| { type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 50 }, | ||
| }, | ||
| }) | ||
| end | ||
|
|
||
| T["with top integration"] = MiniTest.new_set({}) | ||
|
|
||
| T["with top integration"]["resizing below minimum width closes the side buffers"] = function() | ||
| child.cmd("Git") | ||
|
|
||
| child.cmd("set columns-=100") | ||
| child.cmd("doautocmd VimResized") | ||
|
|
||
| Helpers.expect.layout(child, { | ||
| type = "col", | ||
| children = { | ||
| { type = "leaf", filetype = "fugitive", buftype = "nowrite", width = 140, height = 25 }, | ||
| { type = "leaf", filetype = "", buftype = "", width = 140, height = 24 }, | ||
| }, | ||
| }) | ||
| end | ||
|
|
||
| T["with top integration"]["resizing above minimum width reopens the side buffers"] = function() | ||
| child.cmd("Git") | ||
|
|
||
| child.cmd("set columns-=100") | ||
| child.cmd("doautocmd VimResized") | ||
|
|
||
| child.cmd("set columns+=100") | ||
| child.cmd("doautocmd VimResized") | ||
|
|
||
| Helpers.expect.layout(child, { | ||
| type = "col", | ||
| children = { | ||
| { type = "leaf", filetype = "fugitive", buftype = "nowrite", width = 240, height = 25 }, | ||
| { | ||
| type = "row", | ||
| children = { | ||
| { type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 24 }, | ||
| { type = "leaf", filetype = "", buftype = "", width = 146, height = 24 }, | ||
| { type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 24 }, | ||
| }, | ||
| }, | ||
| }, | ||
| }) | ||
| end | ||
|
|
||
| T["with bottom integration"] = MiniTest.new_set({}) | ||
|
|
||
| T["with bottom integration"]["resizing below minimum width closes the side buffers"] = function() | ||
| child.cmd("Trouble diagnostics") | ||
|
|
||
| child.cmd("set columns-=100") | ||
| child.cmd("doautocmd VimResized") | ||
|
|
||
| Helpers.expect.layout(child, { | ||
| type = "col", | ||
| children = { | ||
| { type = "leaf", filetype = "", buftype = "", width = 140, height = 39 }, | ||
| { type = "leaf", filetype = "trouble", buftype = "nofile", width = 140, height = 10 }, | ||
| }, | ||
| }) | ||
| end | ||
|
|
||
| T["with bottom integration"]["resizing above minimum width reopens the side buffers"] = function() | ||
| child.cmd("Trouble diagnostics") | ||
|
|
||
| child.cmd("set columns-=100") | ||
| child.cmd("doautocmd VimResized") | ||
|
|
||
| child.cmd("set columns+=100") | ||
| child.cmd("doautocmd VimResized") | ||
|
|
||
| Helpers.expect.layout(child, { | ||
| type = "col", | ||
| children = { | ||
| { | ||
| type = "row", | ||
| children = { | ||
| { type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 39 }, | ||
| { type = "leaf", filetype = "", buftype = "", width = 146, height = 39 }, | ||
| { type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 39 }, | ||
| }, | ||
| }, | ||
| { type = "leaf", filetype = "trouble", buftype = "nofile", width = 240, height = 10 }, | ||
| }, | ||
| }) | ||
| end | ||
|
|
||
| T["with top and bottom integration"] = MiniTest.new_set({}) | ||
|
|
||
| T["with top and bottom integration"]["resizing below minimum width closes the side buffers"] = function() | ||
| child.cmd("Git") | ||
| child.cmd("Trouble diagnostics") | ||
|
|
||
| child.cmd("set columns-=100") | ||
| child.cmd("doautocmd VimResized") | ||
|
|
||
| Helpers.expect.layout(child, { | ||
| type = "col", | ||
| children = { | ||
| { type = "leaf", filetype = "fugitive", buftype = "nowrite", width = 140, height = 25 }, | ||
| { type = "leaf", filetype = "", buftype = "", width = 140, height = 13 }, | ||
| { type = "leaf", filetype = "trouble", buftype = "nofile", width = 140, height = 10 }, | ||
| }, | ||
| }) | ||
| end | ||
|
|
||
| return T |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
git clone ... $@targets assume$(START_DIR)already exists. On a fresh checkoutdeps/pack/testing/startwon't exist, sogit clonewill fail because parent directories are missing. Add amkdir -p $(START_DIR)step (e.g., an order-only prerequisite or a dedicated directory target) before cloning.