Skip to content

Commit

Permalink
fix: open_output respects configured toggleterm size
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Jul 11, 2024
1 parent fe2321d commit 98c2199
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- uses: stevearc/nvim-typecheck-action@v2
with:
path: lua
libraries: https://github.com/nvim-neotest/neotest https://github.com/mfussenegger/nvim-dap
libraries: https://github.com/nvim-neotest/neotest https://github.com/mfussenegger/nvim-dap https://github.com/akinsho/toggleterm.nvim

run_tests:
strategy:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test:
./run_tests.sh

lint: scripts/nvim-typecheck-action fastlint
./scripts/nvim-typecheck-action/typecheck.sh --lib https://github.com/nvim-neotest/neotest --lib https://github.com/mfussenegger/nvim-dap --workdir scripts/nvim-typecheck-action lua
./scripts/nvim-typecheck-action/typecheck.sh --lib https://github.com/nvim-neotest/neotest --lib https://github.com/mfussenegger/nvim-dap --lib https://github.com/akinsho/toggleterm.nvim --workdir scripts/nvim-typecheck-action lua

fastlint: scripts/nvim_doc_tools
python scripts/main.py lint
Expand Down
8 changes: 8 additions & 0 deletions lua/overseer/strategy/toggleterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local terminal = require("toggleterm.terminal")

---@class overseer.ToggleTermStrategy : overseer.Strategy
---@field private opts overseeer.ToggleTermStrategyOpts
---@field private term? Terminal
local ToggleTermStrategy = {}

---@class overseeer.ToggleTermStrategyOpts
Expand Down Expand Up @@ -145,4 +146,11 @@ function ToggleTermStrategy:dispose()
end
end

---@param direction "float"|"tab"|"vertical"|"horizontal"
function ToggleTermStrategy:open_terminal(direction)
if self.term then
self.term:open(self.opts.size, direction)
end
end

return ToggleTermStrategy
6 changes: 1 addition & 5 deletions lua/overseer/task.lua
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,7 @@ function Task:open_output(direction)
-- gross if statement here.
if self.strategy.name == "toggleterm" and direction then
---@diagnostic disable-next-line: undefined-field
local term = self.strategy.term
if not term then
return
end
term:open(nil, direction)
self.strategy:open_terminal(direction)
return
end

Expand Down

0 comments on commit 98c2199

Please sign in to comment.