Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ its terminal session.
## Float Window Hosts

The built-in `native` host is the default. It uses Neovim's window API directly, has no optional UI
dependency, and provides the agent-aware title, border highlights, and responsive sizing described
by the shared float settings.
dependency, and has a rounded border with a centered, agent-aware title. Its surface and border use
the editor's base `Normal` highlight rather than the raised `NormalFloat` background. Responsive
sizing is shared by both float hosts.

Set `float.host = "snacks"` to use
[`Snacks.win`](https://github.com/folke/snacks.nvim/blob/main/docs/win.md) for floating views:
Expand Down
3 changes: 3 additions & 0 deletions doc/agent-term.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ Float keys:
`height` Proportion (0, 1] of editor height or row count; default: 0.8
`border` Neovim floating-window border; default: "rounded"

The native float has a rounded border and centered agent-aware title by
default. Its surface and border use the editor's base `Normal` highlight.

The Snacks host is optional and applies only to floats; panels always remain
native. If `host = "snacks"` cannot load snacks.nvim, Agent Term warns and
caches the native fallback for the current Neovim run while the configured
Expand Down
6 changes: 3 additions & 3 deletions lua/agent_term/ui/float/native.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ local winhighlight = table.concat({
}, ",")

local function apply_default_highlights()
vim.api.nvim_set_hl(0, "AgentTermFloat", { default = true, link = "NormalFloat" })
vim.api.nvim_set_hl(0, "AgentTermFloatBorder", { default = true, link = "FloatBorder" })
vim.api.nvim_set_hl(0, "AgentTermFloatTitle", { default = true, link = "FloatTitle" })
vim.api.nvim_set_hl(0, "AgentTermFloat", { default = true, link = "Normal" })
vim.api.nvim_set_hl(0, "AgentTermFloatBorder", { default = true, link = "Normal" })
vim.api.nvim_set_hl(0, "AgentTermFloatTitle", { default = true, link = "Title" })
end

apply_default_highlights()
Expand Down
1 change: 1 addition & 0 deletions tests/spec/config_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe("Given multi-agent configuration", function()
assert.are.equal("codex", config.active_agent)
assert.is_false(opts.agents.codex.context.hook.enabled)
assert.are.equal("native", opts.float.host)
assert.are.equal("rounded", opts.float.border)
assert.is_false(opts.keymaps)
end)

Expand Down
10 changes: 6 additions & 4 deletions tests/spec/ui_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,29 @@ describe("Given Agent Term UI views", function()
assert.are.equal(gemini, state.session("gemini").float_win)
end)

it("When opening the native float Then its title and highlights identify the agent", function()
it("When opening the native float Then its rounded frame and title identify the agent", function()
local bufnr = track_buf(vim.api.nvim_create_buf(false, true))
local win = float.open(bufnr, "codex")
local win_config = vim.api.nvim_win_get_config(win)
local window_highlights = vim.api.nvim_get_option_value("winhighlight", { win = win })

assert.are.equal("rounded", config.options.float.border)
assert.are.same({ "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, win_config.border)
assert.are.same({ { " Agent Term · codex ", "AgentTermFloatTitle" } }, win_config.title)
assert.are.equal("center", win_config.title_pos)
assert.matches("Normal:AgentTermFloat", window_highlights, 1, true)
assert.matches("FloatBorder:AgentTermFloatBorder", window_highlights, 1, true)
assert.matches("FloatTitle:AgentTermFloatTitle", window_highlights, 1, true)
assert.are.equal(
"NormalFloat",
"Normal",
vim.api.nvim_get_hl(0, { name = "AgentTermFloat", link = true }).link
)
assert.are.equal(
"FloatBorder",
"Normal",
vim.api.nvim_get_hl(0, { name = "AgentTermFloatBorder", link = true }).link
)
assert.are.equal(
"FloatTitle",
"Title",
vim.api.nvim_get_hl(0, { name = "AgentTermFloatTitle", link = true }).link
)
end)
Expand Down