From eb4b0bb9a47fd6ef683f3c52fca804245d41168b Mon Sep 17 00:00:00 2001 From: Robert <35533304+merefield@users.noreply.github.com> Date: Fri, 27 Nov 2026 09:46:59 +0000 Subject: [PATCH 1/2] FIX: make the blank row above the session composer clickable --- README.md | 12 ++++--- internal/ui/monitor_command_popup_test.go | 1 + internal/ui/monitor_context.go | 10 ++---- internal/ui/monitor_context_modes.go | 17 ++++++---- internal/ui/monitor_history.go | 6 ++-- internal/ui/monitor_inline_prompt_test.go | 3 +- internal/ui/monitor_prompt.go | 22 +++++++++--- internal/ui/monitor_prompt_test.go | 37 ++++++++++++++++++--- internal/ui/monitor_queue_test.go | 24 ++++++++++--- internal/ui/monitor_schedule.go | 4 +-- internal/ui/monitor_schedule_pane.go | 3 +- internal/ui/monitor_schedule_pane_test.go | 5 +-- internal/ui/monitor_schedule_toggle_test.go | 2 +- internal/ui/monitor_turn_test.go | 6 ++-- 14 files changed, 110 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 0d190592..b6228770 100644 --- a/README.md +++ b/README.md @@ -1673,8 +1673,9 @@ same action on that session. The presentations are: can still require action in Codex. The selected session also offers a follow-up composer here when the shared server confirms it is ready for input and the complete context plus composer - fit. Only one inline composer is available at a time. Click its input line or - press `Enter` to focus, then `Enter` to send; `Esc` leaves the editor without + fit. Only one inline composer is available at a time. Click its input or the + blank row above it, or press `Enter` to focus. Press `Enter` to send; + `Esc` leaves the editor without changing the row view. Drafts wrap and scroll within spare space, preserving the context above. Resizing to hide the composer releases keyboard focus; enlarge the window and refocus to continue the draft. Approval requests and @@ -1876,9 +1877,10 @@ On tall terminals, full detail retains the summary and attention strip. When space becomes limited, the summary disappears first, then the attention strip. The budget reserves the actual approval/composer control rows and useful text space; long drafts, wrapped controls and translated labels are taken into account. -In full detail, clicking anywhere across the bottom three rows of the detail panel -focuses an available composer without sending text. Footer controls outside the -panel and approval controls keep their existing behaviour. +In full detail, clicking the composer, the dark blank row directly above it, or +the hint row below it focuses the editor without sending text. The bottom border +still accepts focus clicks outside any buttons. Footer and approval controls keep +their existing behaviour. The overview keeps its compact summary and reserves one attention row to preserve session content. Existing footer, approval, dismiss and editor click targets use the same layout as rendering. Keyboard navigation and approval confirmations diff --git a/internal/ui/monitor_command_popup_test.go b/internal/ui/monitor_command_popup_test.go index 274c79e9..06b2a772 100644 --- a/internal/ui/monitor_command_popup_test.go +++ b/internal/ui/monitor_command_popup_test.go @@ -90,6 +90,7 @@ func TestMonitorCommandPopupPreservesContextComposerAndRowMode(t *testing.T) { if !strings.Contains(out, "CONVERSATION STAYS VISIBLE") || !strings.Contains(out, "Medium") || f.calls != 0 { t.Fatalf("submenu replaced context or applied a command: %s", out) } + assertDarkComposerSpacer(t, m, before.x, before.width, before.y+before.height) if lipgloss.Width(out) > m.width || lipgloss.Height(out) > m.height { t.Fatalf("popup exceeds viewport at %v mode %d", size, mode) } diff --git a/internal/ui/monitor_context.go b/internal/ui/monitor_context.go index cdb39fd0..beeadfd4 100644 --- a/internal/ui/monitor_context.go +++ b/internal/ui/monitor_context.go @@ -431,13 +431,9 @@ func (m Model) monitorContextAt(x, y int) string { if hit := m.monitorNavigationHit(g.contentWidth, m.monitorContextDetail, true, x, y); hit != "" { return hit } - if rows := m.monitorPromptRows(g.contentWidth, g.meterHeight); rows > 0 && m.monitorPromptOffer().Token != "" { - _, _, controlY := monitorContextBodyLayout(g.meterHeight, rows) - inEditor := y >= controlY+m.monitorPromptHeaderRows() && y < controlY+rows-1 && x >= 2 && x < g.contentWidth-2 - // Include the full-width bottom three rows of the detail frame, - // without taking clicks from the global footer below it. - inBottom := y >= g.meterHeight-3 && y < g.meterHeight && x >= 0 && x < g.contentWidth - if inEditor || inBottom { + if m.monitorPromptOffer().Token != "" { + if controls := m.layoutDetailControlsBase(g.contentWidth, g.meterHeight); controls.kind == "prompt" && + m.monitorPromptHit(g.contentWidth, g.meterHeight, controls.rows, x, y) { return "prompt" } } diff --git a/internal/ui/monitor_context_modes.go b/internal/ui/monitor_context_modes.go index 120e395e..84896394 100644 --- a/internal/ui/monitor_context_modes.go +++ b/internal/ui/monitor_context_modes.go @@ -281,6 +281,7 @@ func (m Model) renderExpandedContext(width, height int, s monitorSession, colors buttons := m.expandedApprovalButtons(width, height, s) n := 0 controls := "" + composer := false if len(buttons) > 0 { n = buttons[len(buttons)-1].y + 1 controls = m.renderMonitorApprovalControls(width, height, colors) @@ -292,6 +293,7 @@ func (m Model) renderExpandedContext(width, height int, s monitorSession, colors if rows := m.monitorPromptRows(width, height); rows > 0 { n = rows controls = m.renderMonitorPrompt(width, height, colors) + composer = true } } if dots := m.sessionActivityDots(s); n == 0 && dots != "" && height >= 5 && width >= 7 { @@ -312,6 +314,12 @@ func (m Model) renderExpandedContext(width, height int, s monitorSession, colors withoutTask.preview.CurrentTask, withoutTask.preview.LatestGuidance = "", "" lines = m.expandedContextLines(width, withoutTask) } + if composer && textRows <= 5 && len(lines) > 1 && s.preview.Kind == codex.SessionContextReply && + (m.monitorCommands.open || m.suggestionsActive()) { + // The row title and telemetry already identify the session. Give + // the first text row to its reply when a compact slash popup opens. + lines = lines[1:] + } if hasWorkingCommand(s.preview) { lines = m.workingContextLines(s.preview, max(width-4, 1), max(textRows, 1), false) } @@ -419,12 +427,9 @@ func (m Model) expandedContextAt(x, y int) string { mw, cw, _ := monitorSessionColumnWidths(a.width) x -= mw + 1 y -= rowY - if s.id == m.monitorContextTarget() && m.monitorPromptOffer().Token != "" { - if rows := m.monitorPromptRows(cw, heights[i]); rows > 0 { - _, _, cy := monitorContextBodyLayout(heights[i], rows) - if y >= cy+m.monitorPromptHeaderRows() && y < cy+rows-1 && x >= 2 && x < cw-2 { - return "prompt" - } + if s.id == m.monitorContextTarget() && !m.monitorApprovalHasOutcome() && m.monitorPromptOffer().Token != "" { + if rows := m.monitorPromptRows(cw, heights[i]); rows > 0 && m.monitorPromptHit(cw, heights[i], rows, x, y) { + return "prompt" } } if hit := monitorButtonAt(m.expandedApprovalButtons(cw, heights[i], s), heights[i], x, y); hit != "" { diff --git a/internal/ui/monitor_history.go b/internal/ui/monitor_history.go index 1ff80091..eff2a1c4 100644 --- a/internal/ui/monitor_history.go +++ b/internal/ui/monitor_history.go @@ -362,8 +362,10 @@ func (m Model) detailPage(width, height, controls int) monitorDetailPage { } // Keep a blank before the first heading if it fits. For an already // scrolling document, keep it on roomy viewports but not on short ones. - if n < len(doc) && doc[n] == (detailLine{}) && len(doc) > p.rows && - (p.rows < 8 || len(doc)-1 == p.rows) { + // A short viewport with a slash popup uses that row for reply text. + compactPopup := p.rows < 8 && (m.monitorCommands.open || m.suggestionsActive()) + if n < len(doc) && doc[n] == (detailLine{}) && + (compactPopup || len(doc) > p.rows && (p.rows < 8 || len(doc)-1 == p.rows)) { doc = append(doc[:n], doc[n+1:]...) } p.document = spaceCommandReview(doc, p.rows, false) diff --git a/internal/ui/monitor_inline_prompt_test.go b/internal/ui/monitor_inline_prompt_test.go index b0ef5c20..d2027ee7 100644 --- a/internal/ui/monitor_inline_prompt_test.go +++ b/internal/ui/monitor_inline_prompt_test.go @@ -26,7 +26,7 @@ func TestInlineMonitorPromptClicksAndSend(t *testing.T) { w, h := m.monitorPromptSize() rows := m.monitorPromptRows(w, h) placeholder := ansi.Truncate(i18n.Text("[ Click here or press Enter to write ]"), max(w-4, 1), "") - if rows != 2 || !strings.Contains(ansi.Strip(m.render()), placeholder) { + if rows != 3 || !strings.Contains(ansi.Strip(m.render()), placeholder) { t.Fatalf("missing inline composer at width %d", width) } g := m.dashboardLayout() @@ -34,6 +34,7 @@ func TestInlineMonitorPromptClicksAndSend(t *testing.T) { mw, _, _ := monitorSessionColumnWidths(a.width) _, _, cy := monitorContextBodyLayout(h, rows) y := g.meterY + a.topHeight + a.gap - 1 + cy + assertDarkComposerSpacer(t, m, mw+5, w-4, y) for x := mw + 5; x < mw+3+w-2; x++ { if got := m.monitorContextAt(x, y); got != "prompt" { t.Fatalf("width %d click %d,%d = %q", width, x, y, got) diff --git a/internal/ui/monitor_prompt.go b/internal/ui/monitor_prompt.go index eba9623d..140c26db 100644 --- a/internal/ui/monitor_prompt.go +++ b/internal/ui/monitor_prompt.go @@ -119,6 +119,8 @@ func (m Model) monitorPromptOffer() codex.SessionPromptOffer { return o } +const monitorComposerSpacerRows = 1 + func (m Model) monitorPromptRows(width, height int) int { if s, ok := m.contextDetailSession(); ok { if _, pending := m.sessionProfile(s); pending { @@ -137,10 +139,10 @@ func (m Model) monitorPromptRows(width, height int) int { if m.monitorPromptOffer().Token != "" || m.monitorPrompt.session == m.monitorContextTarget() && (m.monitorPrompt.busy || m.monitorPrompt.notice != "" && !sentNotice(m.monitorPrompt.notice)) { p := m.monitorPrompt headerRows := m.monitorPromptHeaderRows() - rows := 2 + headerRows + rows := 2 + headerRows + monitorComposerSpacerRows if (p.input.Focused() || p.input.Value() != "") && !p.busy { p.input.configure(width, m.monitorPromptEditorHeight(width, height)) - rows = p.input.Height() + 1 + headerRows + rows = p.input.Height() + 1 + headerRows + monitorComposerSpacerRows } if m.monitorContextDetail == "" { s, ok := m.contextDetailSession() @@ -164,6 +166,17 @@ func (m Model) monitorPromptHeaderRows() int { return 0 } +func (m Model) monitorPromptHit(width, height, rows, x, y int) bool { + _, _, top := monitorContextBodyLayout(height, rows) + spacer := top + m.monitorPromptHeaderRows() + // Full detail also accepts the full-width spacer, hint and bottom border. + // Explicit buttons in those rows are checked before the composer. + if m.monitorContextDetail != "" && x >= 0 && x < width && (y == spacer || y >= height-3 && y < height) { + return true + } + return x >= 2 && x < width-2 && y >= spacer && y < top+rows-1 +} + func (m Model) monitorComposerActivity() string { if m.monitorPromptOffer().TurnID != "" { if s, ok := m.contextDetailSession(); ok { @@ -176,7 +189,7 @@ func (m Model) monitorComposerActivity() string { // Inline drafts grow only into spare space, then scroll inside the editor; // they never displace the source context. Full detail keeps its usual viewport. func (m Model) monitorPromptEditorHeight(width, height int) int { - extra := 1 - m.monitorPromptHeaderRows() + extra := 1 - m.monitorPromptHeaderRows() - monitorComposerSpacerRows if m.monitorContextDetail == "" { if s, ok := m.contextDetailSession(); ok { return min(height+extra, max(8, height+3+extra-len(m.expandedContextLines(width, s)))) @@ -281,7 +294,8 @@ func (m Model) renderMonitorPrompt(width, height int, colors palette) string { if scheduling && !m.hasGoalResume() { footer = m.renderScheduleToggleHint(width, hint, false, hintStyle, colors) } - body := strings.Join(inputLines, "\n") + "\n" + footer + // Keep this row unstyled so the frame paints the normal dark background. + body := "\n" + strings.Join(inputLines, "\n") + "\n" + footer if header != "" { body = colors.label().Render(ansi.Truncate(header, max(width-4, 1), "…")) + "\n" + body } diff --git a/internal/ui/monitor_prompt_test.go b/internal/ui/monitor_prompt_test.go index 90f8ca88..f26deaed 100644 --- a/internal/ui/monitor_prompt_test.go +++ b/internal/ui/monitor_prompt_test.go @@ -34,7 +34,7 @@ func TestMonitorPromptPlaceholderComposerBackground(t *testing.T) { t.Fatal("composer has no background") } for x := 0; x < width-4; x++ { - cell := cells.CellAt(x, 0) + cell := cells.CellAt(x, monitorComposerSpacerRows) if cell == nil || cell.Style.Bg == nil { t.Fatalf("theme %d width %d: missing placeholder background at %d", theme, width, x) } @@ -144,7 +144,7 @@ func TestMonitorPromptQuestionsAndSecret(t *testing.T) { m.monitorSessionData[0].preview.InputToken = c.offer.Token m.focusMonitorPrompt() question := strings.Split(ansi.Strip(m.renderMonitorPrompt(120, 30, paletteFor(m.theme))), "\n") - if len(question) != 3 || !strings.Contains(question[0], "REPLY 1/2") || !strings.Contains(question[0], "Pick one") || m.monitorPromptHeaderRows() != 1 { + if len(question) != 4 || question[1] != "" || !strings.Contains(question[0], "REPLY 1/2") || !strings.Contains(question[0], "Pick one") || m.monitorPromptHeaderRows() != 1 { t.Fatal("structured question lost its heading or answer progress") } m.monitorPrompt.input.SetValue("not offered") @@ -211,7 +211,7 @@ func TestMonitorPromptResponsiveClickTargets(t *testing.T) { continue } _, _, y := monitorContextBodyLayout(g.meterHeight, rows) - y += g.meterY + 1 + y += g.meterY for x := 4; x < g.contentWidth; x++ { if m.monitorContextAt(x, y) != "prompt" { t.Fatalf("miss %s %v %d,%d", lang, size, x, y) @@ -288,7 +288,7 @@ func TestMonitorPromptWrapsAndGrowsUpward(t *testing.T) { t.Fatal("wrapping altered the submitted text") } m.monitorPrompt.input.SetValue("short") - if m.monitorPromptRows(g.contentWidth, g.meterHeight) != 2 { + if m.monitorPromptRows(g.contentWidth, g.meterHeight) != 3 { t.Fatal("editor failed to shrink") } } @@ -300,6 +300,14 @@ func TestMonitorDetailBottomRowsFocusComposer(t *testing.T) { m.height = height g := m.monitorDashboardLayout() copyX, copyY := renderedTextStart(t, m, benchmarkDetailCopyLabel) + composerY := g.meterY + g.meterHeight - 3 + assertDarkComposerSpacer(t, m, 4, g.contentWidth-4, composerY-1) + for _, x := range []int{2, 4, 1 + g.contentWidth} { + n, _ := m.Update(tea.MouseClickMsg{X: x, Y: composerY - 1, Button: tea.MouseLeft}) + if !n.(Model).monitorPrompt.input.Focused() || c.answers != nil { + t.Fatalf("spacer click at %d,%d should focus without sending", x, composerY-1) + } + } for y := g.meterY + g.meterHeight - 3; y < g.meterY+g.meterHeight; y++ { for x := 2; x < 2+g.contentWidth; x++ { want := "prompt" @@ -327,6 +335,27 @@ func TestMonitorDetailBottomRowsFocusComposer(t *testing.T) { } } +func assertDarkComposerSpacer(t *testing.T, m Model, x, width, y int) { + t.Helper() + screen := uv.NewScreenBuffer(m.width, m.height) + uv.NewStyledString(m.render()).Draw(&screen, image.Rect(0, 0, m.width, m.height)) + colors := paletteFor(m.theme) + if m.monitorContextDetail == "" { + colors.primary = colors.accent // the selected overview row uses its accent as primary + } + for col := x; col < x+width; col++ { + spacer := screen.CellAt(col, y) + if spacer == nil || strings.TrimSpace(spacer.Content) != "" { + t.Fatalf("expected a blank row above the composer at %d,%d, got %v", col, y, spacer) + } + assertBackground(t, spacer.Style.Bg, colors.background) + // A CJK glyph's trailing cell does not carry its own style. + if col == x || screen.CellAt(col-1, y+1).Width < 2 { + assertBackground(t, screen.CellAt(col, y+1).Style.Bg, monitorComposerBackground(colors)) + } + } +} + func TestMonitorPromptResizeAndWrappedSubmission(t *testing.T) { m, c := promptTestModel() m.focusMonitorPrompt() diff --git a/internal/ui/monitor_queue_test.go b/internal/ui/monitor_queue_test.go index a32bdcb3..26f1d61b 100644 --- a/internal/ui/monitor_queue_test.go +++ b/internal/ui/monitor_queue_test.go @@ -224,18 +224,34 @@ func TestNativeQueuePlacementAndClickSurfaces(t *testing.T) { if activityY != queueY-1 || strings.Count(strings.Join(lines, "\n"), monitorDotWave(m.phase)) != 1 { t.Fatal("task activity must appear exactly once immediately above follow-ups") } - if inline && !strings.Contains(lines[queueY], "1–1") { - t.Fatal("wide row didn't collapse queue") + if inline { + want := "1–1" + if size == [2]int{80, 32} { + want = "open follow-ups" + } + if !strings.Contains(lines[queueY], want) { + t.Fatalf("%v wide row lost its responsive queue: %q", size, lines[queueY]) + } + } + g := m.monitorDashboardLayout() + composerX, composerWidth := 4, g.contentWidth + if inline { + left, width, _ := monitorSessionColumnWidths(g.contentWidth) + composerX, composerWidth = left+5, width + } + assertDarkComposerSpacer(t, m, composerX, composerWidth-4, composerY-1) + if m.monitorContextAt(composerX, composerY-1) != "prompt" { + t.Fatal("queue intercepted the composer spacer") } // Composer remains anchored at its existing position. w, h := m.monitorPromptSize() rows := m.monitorPromptRows(w, h) - if rows != 3 && !m.monitorPrompt.input.Focused() { + if rows != 4 && !m.monitorPrompt.input.Focused() { t.Fatal("queue changed composer size") } m.monitorQueue.items = nil withoutQueue := strings.Split(ansi.Strip(m.render()), "\n") - if withoutQueue[composerY] != lines[composerY] || !strings.Contains(withoutQueue[composerY-1], monitorDotWave(m.phase)) { + if withoutQueue[composerY] != lines[composerY] || !strings.Contains(withoutQueue[composerY-2], monitorDotWave(m.phase)) { t.Fatal("moving animation shifted composer or lost its no-queue placement") } } diff --git a/internal/ui/monitor_schedule.go b/internal/ui/monitor_schedule.go index 3d438336..f61ae447 100644 --- a/internal/ui/monitor_schedule.go +++ b/internal/ui/monitor_schedule.go @@ -80,7 +80,7 @@ func (m *Model) openSchedule() tea.Cmd { } p := scheduleUI{queue: q, polling: m.scheduleUI.polling, drafts: m.scheduleUI.drafts, open: true, session: id, input: newMonitorEditor(), hours: 1, date: time.Now().Add(time.Hour).Truncate(time.Minute)} g := m.monitorDashboardLayout() - p.composerRows = max(2, m.monitorPromptRows(g.contentWidth, g.meterHeight)) + p.composerRows = max(2, m.monitorPromptRows(g.contentWidth, g.meterHeight)-monitorComposerSpacerRows) if m.monitorPrompt.session == id { p.input = m.monitorPrompt.input } @@ -299,7 +299,7 @@ func (m Model) updateSchedule(msg tea.Msg) (Model, tea.Cmd, bool) { if click.X < 2 || click.X >= g.contentWidth-2 { return m, nil, true } - if localY >= layout.composerY && localY < layout.composerY+layout.composerRows { + if localY >= layout.composerY-monitorComposerSpacerRows && localY < layout.composerY+layout.composerRows { p.focus = 0 return m, p.input.Focus(), true } diff --git a/internal/ui/monitor_schedule_pane.go b/internal/ui/monitor_schedule_pane.go index 7d93e45f..734dcfbf 100644 --- a/internal/ui/monitor_schedule_pane.go +++ b/internal/ui/monitor_schedule_pane.go @@ -20,7 +20,8 @@ func (m Model) schedulePaneLayout(width, height int) schedulePaneLayout { l.indices = append(l.indices, row) } l.composerRows = min(max(p.composerRows, 2), max(height-5, 1)) - l.textRows, _, l.composerY = monitorContextBodyLayout(height, l.composerRows) + l.textRows, _, l.composerY = monitorContextBodyLayout(height, l.composerRows+monitorComposerSpacerRows) + l.composerY += monitorComposerSpacerRows l.scroll = min(max(p.scroll, 0), max(len(l.indices)-l.textRows, 0)) return l } diff --git a/internal/ui/monitor_schedule_pane_test.go b/internal/ui/monitor_schedule_pane_test.go index e0843f1f..c663b8e2 100644 --- a/internal/ui/monitor_schedule_pane_test.go +++ b/internal/ui/monitor_schedule_pane_test.go @@ -95,8 +95,9 @@ func TestSchedulePaneScrollAndHitTargets(t *testing.T) { if !actionVisible { t.Fatal("keyboard focus left action offscreen") } - // Clicking composer focuses it without changing the scroll/trigger. - m, _, _ = m.updateSchedule(tea.MouseClickMsg{X: 6, Y: g.meterY + l.composerY + 1, Button: tea.MouseLeft}) + // Clicking the dark spacer focuses the anchored composer without changing the form. + assertDarkComposerSpacer(t, m, 4, g.contentWidth-4, g.meterY+l.composerY-1) + m, _, _ = m.updateSchedule(tea.MouseClickMsg{X: 6, Y: g.meterY + l.composerY - 1, Button: tea.MouseLeft}) if m.scheduleUI.focus != 0 || !m.scheduleUI.input.Focused() { t.Fatal("anchored composer click missed") } diff --git a/internal/ui/monitor_schedule_toggle_test.go b/internal/ui/monitor_schedule_toggle_test.go index 6282bd78..42f85675 100644 --- a/internal/ui/monitor_schedule_toggle_test.go +++ b/internal/ui/monitor_schedule_toggle_test.go @@ -49,7 +49,7 @@ func TestScheduleToggleRenderedHoverAndClicks(t *testing.T) { } else { rows := m.monitorPromptRows(g.contentWidth, g.meterHeight) _, _, cy := monitorContextBodyLayout(g.meterHeight, rows) - if y != g.meterY+cy+rows-1 || rows != 2 { + if y != g.meterY+cy+rows-1 || rows != 3 { t.Fatal("idle composer retained a heading or misplaced schedule button") } } diff --git a/internal/ui/monitor_turn_test.go b/internal/ui/monitor_turn_test.go index 5d214263..938fceff 100644 --- a/internal/ui/monitor_turn_test.go +++ b/internal/ui/monitor_turn_test.go @@ -35,7 +35,7 @@ func TestInlineWorkingComposerKeysAndClicks(t *testing.T) { m.width = width w, h := m.monitorPromptSize() rows := m.monitorPromptRows(w, h) - if rows != 3 || !strings.Contains(ansi.Strip(m.render()), "Tab: queue") { + if rows != 4 || !strings.Contains(ansi.Strip(m.render()), "Tab: queue") { t.Fatalf("missing working composer at width %d", width) } g := m.dashboardLayout() @@ -216,7 +216,7 @@ func TestWorkingComposerErrorAndScheduleIsolation(t *testing.T) { t.Fatal("failed queue lost draft or hid error") } view := m.renderMonitorPrompt(120, 30, paletteFor(themeHacker)) - if !strings.Contains(view, monitorDotWave(m.phase)) || strings.Contains(view, "FOLLOW-UP") || strings.Contains(view, "WORKING") || len(strings.Split(view, "\n")) != 3 { + if !strings.Contains(view, monitorDotWave(m.phase)) || strings.Contains(view, "FOLLOW-UP") || strings.Contains(view, "WORKING") || len(strings.Split(view, "\n")) != 4 { t.Fatal("composer must retain progress above the input without a redundant heading") } if ansi.Strip(strings.Split(view, "\n")[0]) != monitorDotWave(m.phase) { @@ -224,7 +224,7 @@ func TestWorkingComposerErrorAndScheduleIsolation(t *testing.T) { } m.monitorSessionData[0].working = false view = m.renderMonitorPrompt(120, 30, paletteFor(themeHacker)) - if strings.Contains(view, monitorDotWave(m.phase)) || m.monitorPromptHeaderRows() != 0 || len(strings.Split(view, "\n")) != 2 { + if strings.Contains(view, monitorDotWave(m.phase)) || m.monitorPromptHeaderRows() != 0 || len(strings.Split(view, "\n")) != 3 { t.Fatal("inactive session retained a progress row") } } From 874b77fa5adabf96d60a1a9c54a607e7f0212d68 Mon Sep 17 00:00:00 2001 From: Robert <35533304+merefield@users.noreply.github.com> Date: Fri, 27 Nov 2026 10:17:26 +0000 Subject: [PATCH 2/2] FIX: focus the inline composer from its keyboard hints --- README.md | 8 +++---- internal/ui/monitor_inline_prompt_test.go | 28 +++++++++++++++++++---- internal/ui/monitor_prompt.go | 12 ++++++---- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b6228770..23757a61 100644 --- a/README.md +++ b/README.md @@ -1673,10 +1673,10 @@ same action on that session. The presentations are: can still require action in Codex. The selected session also offers a follow-up composer here when the shared server confirms it is ready for input and the complete context plus composer - fit. Only one inline composer is available at a time. Click its input or the - blank row above it, or press `Enter` to focus. Press `Enter` to send; - `Esc` leaves the editor without - changing the row view. Drafts wrap and scroll within spare space, preserving + fit. Only one inline composer is available at a time. Click its input, the + blank row above it, or the hints below it to focus, or press `Enter`. + Press `Enter` to send; `Esc` leaves the editor without changing the row view. + Drafts wrap and scroll within spare space, preserving the context above. Resizing to hide the composer releases keyboard focus; enlarge the window and refocus to continue the draft. Approval requests and structured questions do not use this inline composer; use full detail instead. diff --git a/internal/ui/monitor_inline_prompt_test.go b/internal/ui/monitor_inline_prompt_test.go index d2027ee7..30c5aeb6 100644 --- a/internal/ui/monitor_inline_prompt_test.go +++ b/internal/ui/monitor_inline_prompt_test.go @@ -40,17 +40,35 @@ func TestInlineMonitorPromptClicksAndSend(t *testing.T) { t.Fatalf("width %d click %d,%d = %q", width, x, y, got) } } - next, _ := m.Update(tea.MouseClickMsg{X: mw + 5, Y: y, Button: tea.MouseLeft}) - m = next.(Model) - if !m.monitorPrompt.input.Focused() || m.monitorContextDetail != "" { - t.Fatal("composer click navigated instead of focusing") + hintY, left := y+rows-1, mw+3 + for x := left; x < left+w; x++ { + if got := m.monitorContextAt(x, hintY); got != "prompt" { + t.Fatalf("width %d hint click %d,%d = %q", width, x, hintY, got) + } + } + for _, x := range []int{left - 1, left + w} { + if m.monitorContextAt(x, hintY) == "prompt" { + t.Fatalf("hint click leaked outside the detail pane at %d,%d", x, hintY) + } + } + copyX, copyY := renderedTextStart(t, m, benchmarkDetailCopyLabel) + if copyY != hintY+1 || m.monitorContextAt(copyX, copyY) != "copy:root-one" { + t.Fatal("composer hint displaced or intercepted Copy") + } + base := m + for _, clickY := range []int{y, hintY} { + next, _ := base.Update(tea.MouseClickMsg{X: mw + 5, Y: clickY, Button: tea.MouseLeft}) + m = next.(Model) + if !m.monitorPrompt.input.Focused() || m.monitorContextDetail != "" || c.answers != nil { + t.Fatalf("click at row %d did not just focus the inline composer", clickY) + } } m, _ = promptKey(m, 't', "t") m, cmd := promptKey(m, tea.KeyEnter, "") if cmd == nil || !m.monitorPrompt.busy { t.Fatal("inline Enter did not send") } - next, _ = m.Update(cmd()) + next, _ := m.Update(cmd()) m = next.(Model) if len(c.answers) != 1 || c.answers[0] != "t" || m.monitorPrompt.input.Focused() { t.Fatal("inline send destination/content or focus incorrect") diff --git a/internal/ui/monitor_prompt.go b/internal/ui/monitor_prompt.go index 140c26db..bd9719a3 100644 --- a/internal/ui/monitor_prompt.go +++ b/internal/ui/monitor_prompt.go @@ -167,14 +167,18 @@ func (m Model) monitorPromptHeaderRows() int { } func (m Model) monitorPromptHit(width, height, rows, x, y int) bool { + if x < 0 || x >= width { + return false + } _, _, top := monitorContextBodyLayout(height, rows) spacer := top + m.monitorPromptHeaderRows() - // Full detail also accepts the full-width spacer, hint and bottom border. - // Explicit buttons in those rows are checked before the composer. - if m.monitorContextDetail != "" && x >= 0 && x < width && (y == spacer || y >= height-3 && y < height) { + hint := top + rows - 1 + // The whole hint row focuses either composer. Full detail also accepts + // clicks on the spacer and bottom border outside their explicit buttons. + if y == hint || m.monitorContextDetail != "" && (y == spacer || y >= height-3 && y < height) { return true } - return x >= 2 && x < width-2 && y >= spacer && y < top+rows-1 + return x >= 2 && x < width-2 && y >= spacer && y < hint } func (m Model) monitorComposerActivity() string {