Move voice controls into a dedicated composer strip (#43683)

## Why

Voice controls replaced the normal footer and could be truncated at narrow widths. Give them dedicated space while keeping the status line visible.

## What changed

- Render voice status, `ctrl+x` mute/unmute, and `/voice stop` above the draft, with separate microphone and Codex audio history meters.
- Keep control positions stable across mute states, prioritize stop at narrow widths, and hide the strip when vertical space is needed for the draft and cursor.
- Reflect actual microphone capture in the recording indicator, respect reduced motion, and allow muting during connection once the audio handle is available.
- Preserve speaker history when muting the microphone and clear speaker samples when playback is suppressed.

## Testing

Add layout and snapshot regressions for voice states, narrow and clipped composers, recording colors, independent audio histories, and status-line visibility. Extend coverage for audio intensity scaling and spoken transcript rendering.

GitOrigin-RevId: 9deb432654f4328cc8a577b8896eee088a0a1d5e
This commit is contained in:
Benjamin Carlsson authored and copyberry committed 2026-09-08 03:39:58 +00:00
1 parent 3caf9f9586
commit 98c7c0415b
13 files changed
+703 -103

No files matched your search

@@ -0,0 +1,36 @@
//! Reserves popup and voice-control space around the editable draft.
use super::ChatComposer;
use crate::bottom_pane::voice_strip::VoiceStrip;
use crate::bottom_pane::voice_strip::VoiceStripState;
use crate::render::renderable::Renderable;
use crate::tui::FrameRequester;
use ratatui::buffer::Buffer;
use ratatui::layout::Rect;
impl ChatComposer {
pub(crate) fn set_voice_strip(
&mut self,
state: Option<VoiceStripState>,
frame_requester: FrameRequester,
) {
match (self.voice_strip.as_mut(), state) {
(Some(strip), Some(state)) => strip.update(state),
(_, Some(state)) => self.voice_strip = Some(VoiceStrip::new(state, frame_requester)),
(_, None) => self.voice_strip = None,
}
}
pub(super) fn render_voice_strip(&self, composer_rect: Rect, buf: &mut Buffer) {
if let Some(strip) = &self.voice_strip
&& composer_rect.height >= 6
{
let voice_rect = Rect {
y: composer_rect.y.saturating_add(/*rhs*/ 1),
height: 2,
..composer_rect
};
strip.render(voice_rect, buf);
}
}
}