Skip to content
Open
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on Keep a Changelog and this project adheres to SemVer.

## [Unreleased]

### Changed

- Build and logcat dock panels now support consistent `q` / `<Esc>` close
controls, and dock body windows keep a fixed height when additional splits
are opened.

## [0.6.0] - 2026-03-25

### Added
Expand Down
1 change: 1 addition & 0 deletions docs/guides/build-and-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Build output is a two-layer bottom dock:

| Key | Action |
| --- | --- |
| `q`, `<Esc>` | Close build output panel |
| `f` | Edit build filter text |
| `<CR>` | On filter row, open filter edit |

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/logcat.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Logcat uses a two-layer bottom dock:

| Key | Action |
| --- | --- |
| `q` | Close logcat panel |
| `q`, `<Esc>` | Close logcat panel |
| `c` | Clear panel output |
| `C` | Clear output and reset pause state |
| `p` | Pause or resume output |
Expand Down
3 changes: 2 additions & 1 deletion docs/reference/keymaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ vim.keymap.set("n", "<leader>ar", "<Plug>(AndroidRun)", { remap = true, silent =

| Key | Action |
| --- | --- |
| `q` | Close panel |
| `q`, `<Esc>` | Close panel |
| `c` | Clear output |
| `C` | Clear output and reset pause |
| `p` | Pause or resume stream |
Expand All @@ -80,6 +80,7 @@ vim.keymap.set("n", "<leader>ar", "<Plug>(AndroidRun)", { remap = true, silent =

| Key | Action |
| --- | --- |
| `q`, `<Esc>` | Close panel |
| `f` | Edit build filter |
| `<CR>` | On control strip row, open filter edit |

Expand Down
6 changes: 6 additions & 0 deletions lua/android/build/stream.lua
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ local function setup_keymaps(session)
end
end

map("q", function()
panel.close()
end)
map("<Esc>", function()
panel.close()
end)
map("f", function()
start_filter_edit(session)
end)
Expand Down
1 change: 1 addition & 0 deletions lua/android/logcat/session/controls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ local function setup_keymaps(session, deps)
end
end
map("q", function() session.on_close() end)
map("<Esc>", function() session.on_close() end)
map("c", function() clear_panel(session) end)
map("C", function() reset_output(session) end)
map("p", function() toggle_pause(session) end)
Expand Down
9 changes: 9 additions & 0 deletions lua/android/ui/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ local function apply_control_height(height)
pcall(vim.api.nvim_win_set_option, control_win_id, "winfixheight", true)
end

local function fix_body_height()
if not body_win_id or not vim.api.nvim_win_is_valid(body_win_id) then
return
end
pcall(vim.api.nvim_win_set_option, body_win_id, "winfixheight", true)
end

local function pin_window_buffer(win)
if not win or not vim.api.nvim_win_is_valid(win) then
return
Expand Down Expand Up @@ -245,6 +252,7 @@ local function open_dock(options)
if body_win_in_current_tab() and control_win_in_current_tab() then
vim.api.nvim_win_set_buf(body_win_id, body_buf_id)
pin_window_buffer(body_win_id)
fix_body_height()
vim.api.nvim_win_set_buf(control_win_id, control_buf_id)
pin_window_buffer(control_win_id)
apply_control_height(options and options.control_height or header_count)
Expand All @@ -261,6 +269,7 @@ local function open_dock(options)
body_win_id = vim.api.nvim_get_current_win()
vim.api.nvim_win_set_buf(body_win_id, body_buf_id)
pin_window_buffer(body_win_id)
fix_body_height()

vim.cmd("aboveleft split")
control_win_id = vim.api.nvim_get_current_win()
Expand Down
34 changes: 34 additions & 0 deletions lua/tests/android/build/stream_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,37 @@ local function start_build_job_registers_filter_keymap()
)
end

local function start_build_job_registers_close_keymaps()
local outcome = build_stream_helper.run_filter_build()

assert.is_true(
outcome.keymaps and outcome.keymaps["n"]["q"],
"q close keymap"
)
assert.is_true(
outcome.keymaps and outcome.keymaps["n"]["<Esc>"],
"esc close keymap"
)
end

local function close_keymap_closes_panel(lhs)
local outcome = build_stream_helper.run_filter_build({
after_start = function(state)
state.keymaps["n"][lhs]()
end,
})

assert.eq(outcome.panel.closed, true, lhs .. " closes panel")
end

local function q_keymap_closes_panel()
close_keymap_closes_panel("q")
end

local function esc_keymap_closes_panel()
close_keymap_closes_panel("<Esc>")
end

local function run_filter_input(options)
local opts = options or {}
local state = opts.state
Expand Down Expand Up @@ -303,6 +334,9 @@ function M.run()
start_build_job_reports_lines()
start_build_job_sets_header()
start_build_job_registers_filter_keymap()
start_build_job_registers_close_keymaps()
q_keymap_closes_panel()
esc_keymap_closes_panel()
filter_keymap_opens_modal()
filter_input_updates_header()
filter_input_tracks_body_updates()
Expand Down
19 changes: 14 additions & 5 deletions lua/tests/android/logcat/controls/filter_output_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,33 @@ local function filter_change_rebuilds_body_from_raw_lines()
end)
end

local function stopped_session_ignores_late_output()
local function close_keymap_stops_session(lhs)
with_filter_output_context(function(ctx, filter_calls, job_callbacks, appended)
ctx.vim_state.keymaps["n"]["q"]()
ctx.vim_state.keymaps["n"][lhs]()

job_callbacks.on_stdout({ "late line" })

assert.eq(filter_calls.count, 0, "stopped session ignores filter")
assert.eq(appended.lines, nil, "stopped session ignores append")
assert.eq(filter_calls.count, 0, lhs .. " stopped session ignores filter")
assert.eq(appended.lines, nil, lhs .. " stopped session ignores append")
end)
end

local function q_stops_session_ignores_late_output()
close_keymap_stops_session("q")
end

local function esc_stops_session_ignores_late_output()
close_keymap_stops_session("<Esc>")
end

function M.run()
handle_output_filters_lines_count()
handle_output_filters_lines_input()
handle_output_filters_lines_filter_arg()
handle_output_appends_filtered_lines()
filter_change_rebuilds_body_from_raw_lines()
stopped_session_ignores_late_output()
q_stops_session_ignores_late_output()
esc_stops_session_ignores_late_output()
end

return M
13 changes: 13 additions & 0 deletions lua/tests/android/ui/panel/panel_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ local function open_dock_sets_winfixbuf_for_body_and_control_windows()
end)
end

local function open_dock_sets_winfixheight_for_body_and_control_windows()
panel_vim.with_panel_module(
{ on_cmd = panel_vim.on_split_create_window },
function(panel, api_state)
panel.open({ layout = "dock", control_height = 1 })

assert.eq(api_state.win_options[100].winfixheight, true, "body winfixheight")
assert.eq(api_state.win_options[101].winfixheight, true, "control winfixheight")
end
)
end

local function open_dock_preserve_focus_keeps_origin_window_selected()
panel_vim.with_panel_module(
{ on_cmd = panel_vim.on_split_create_window },
Expand Down Expand Up @@ -207,6 +219,7 @@ function M.run()
open_creates_split_window_and_configures_buffer()
open_sets_winfixbuf_for_inline_window()
open_dock_sets_winfixbuf_for_body_and_control_windows()
open_dock_sets_winfixheight_for_body_and_control_windows()
open_dock_preserve_focus_keeps_origin_window_selected()
open_dock_closes_stale_android_windows_before_creating_new_pair()
append_adds_lines_to_open_buffer()
Expand Down
5 changes: 5 additions & 0 deletions lua/tests/helpers/build_stream/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function M.make_panel_state()
replaced_body_history = {},
names = nil,
name_history = {},
closed = false,
}
end

Expand Down Expand Up @@ -94,6 +95,10 @@ function M.make_panel_stub(panel_state, vim_state)
panel_state.names = snapshot
panel_state.name_history[#panel_state.name_history + 1] = snapshot
end,
close = function()
panel_state.closed = true
return true
end,
}
end

Expand Down