TUI footer: right-align context and degrade shortcut summary + mode cleanly (#9944)

## Summary
Refines the bottom footer layout to keep `% context left` right-aligned
while making the left side degrade cleanly

## Behavior with empty textarea
Full width:
<img width="607" height="62" alt="Screenshot 2026-01-26 at 2 59 59 PM"
src="https://github.com/user-attachments/assets/854f33b7-d714-40be-8840-a52eb3bda442"
/>
Less:
<img width="412" height="66" alt="Screenshot 2026-01-26 at 2 59 48 PM"
src="https://github.com/user-attachments/assets/9c501788-c3a2-4b34-8f0b-8ec4395b44fe"
/>
Min width:
<img width="218" height="77" alt="Screenshot 2026-01-26 at 2 59 33 PM"
src="https://github.com/user-attachments/assets/0bed2385-bdbf-4254-8ae4-ab3452243628"
/>

## Behavior with message in textarea and agent running (steer enabled)
Full width:
<img width="753" height="63" alt="Screenshot 2026-01-26 at 4 33 54 PM"
src="https://github.com/user-attachments/assets/1856b352-914a-44cf-813d-1cb50c7f183b"
/>

Less:
<img width="353" height="61" alt="Screenshot 2026-01-26 at 4 30 12 PM"
src="https://github.com/user-attachments/assets/d951c4d5-f3e7-4116-8fe1-6a6c712b3d48"
/>

Less:
<img width="304" height="64" alt="Screenshot 2026-01-26 at 4 30 51 PM"
src="https://github.com/user-attachments/assets/1433e994-5cbc-4e20-a98a-79eee13c8699"
/>

Less:
<img width="235" height="61" alt="Screenshot 2026-01-26 at 4 30 56 PM"
src="https://github.com/user-attachments/assets/e216c3c6-84cd-40fc-ae4d-83bf28947f0e"
/>

Less:
<img width="165" height="59" alt="Screenshot 2026-01-26 at 4 31 08 PM"
src="https://github.com/user-attachments/assets/027de5de-7185-47ce-b1cc-5363ea33d9b1"
/>

## Notes / Edge Cases
- In steer mode while typing, the queue hint no longer replaces the mode
label; it renders as `tab to queue message · {Mode}`.
- Collapse priorities differ by state:
- With the queue hint active, `% context left` is hidden before
shortening or dropping the queue hint.
- In the empty + non-running state, `? for shortcuts` is dropped first,
and `% context left` is only shown if `(shift+tab to
cycle)` can also fit.
- Transient instructional states (`?` overlay, Esc hint, Ctrl+C/D
reminders, and flash/override hints) intentionally suppress the
mode label (and context) to focus the next action.

## Implementation Notes
- Renamed the base footer modes to make the state explicit:
`ComposerEmpty` and `ComposerHasDraft`, and compute the base mode
directly from emptiness.
- Unified collapse behavior in `single_line_footer_layout` for both base
modes, with:
- Queue-hint behavior that prefers keeping the queue hint over context.
- A cycle-hint guard that prevents context from reappearing after
`(shift+tab to cycle)` is dropped.
- Kept rendering responsibilities explicit:
  - `single_line_footer_layout` decides what fits.
  - `render_footer_line` renders a chosen line.
- `render_footer_from_props` renders the canonical mode-to-text mapping.
- Expanded snapshot coverage:
- Added `footer_collapse_snapshots` in `chat_composer.rs` to lock the
distinct collapse states across widths.
- Consolidated the width-aware snapshot helper usage (e.g.,
`snapshot_composer_state_with_width`,
`snapshot_footer_with_mode_indicator`).
This commit is contained in:
Charley Cunningham
2026-01-27 09:43:09 -08:00
committed by GitHub
parent 067922a734
commit 538e1059a3
40 changed files with 949 additions and 167 deletions

View File

@@ -11,4 +11,4 @@ expression: terminal.backend()
" "
" "
" "
" 100% context left "
" 100% context left "

View File

@@ -11,4 +11,4 @@ expression: terminal.backend()
" "
" "
" "
" 100% context left · ? for shortcuts "
" ? for shortcuts 100% context left "

View File

@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
" Ask Codex to do anything "
" "
" "
" "
" "
" "
" "
" ? for shortcuts · Code mode (shift+tab to cycle) 100% context left "

View File

@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
" Ask Codex to do anything "
" "
" "
" "
" "
" "
" "
" Code mode (shift+tab to cycle) 100% context left "

View File

@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
" Ask Codex to do anything "
" "
" "
" "
" "
" "
" "
" Code mode (shift+tab to cycle) "

View File

@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
" Ask Codex to do anythin "
" "
" "
" "
" "
" "
" "
" Code mode "

View File

@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
" Test "
" "
" "
" "
" "
" "
" "
" tab to queue message · Code mode 98% context left "

View File

@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
" Test "
" "
" "
" "
" "
" "
" "
" tab to queue message · Code mode "

View File

@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
" Test "
" "
" "
" "
" "
" "
" "
" Code mode "

View File

@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
" Test "
" "
" "
" "
" "
" "
" "
" tab to queue · Code mode 98% context left "

View File

@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
" Test "
" "
" "
" "
" "
" "
" "
" tab to queue · Code mode "

View File

@@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" 100% context left "
" 100% context left "

View File

@@ -1,6 +1,5 @@
---
source: tui/src/bottom_pane/chat_composer.rs
assertion_line: 2116
expression: terminal.backend()
---
" "
@@ -11,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" 100% context left "
" 100% context left "

View File

@@ -1,6 +1,5 @@
---
source: tui/src/bottom_pane/chat_composer.rs
assertion_line: 2116
expression: terminal.backend()
---
" "
@@ -11,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" 100% context left "
" 100% context left "

View File

@@ -11,4 +11,4 @@ expression: terminal.backend()
" "
" "
" "
" 100% context left "
" 100% context left "

View File

@@ -11,4 +11,4 @@ expression: terminal.backend()
" "
" "
" "
" 100% context left "
" 100% context left "

View File

@@ -11,4 +11,4 @@ expression: terminal.backend()
" "
" "
" "
" 100% context left "
" 100% context left "

View File

@@ -0,0 +1,5 @@
---
source: tui/src/bottom_pane/footer.rs
expression: terminal.backend()
---
" 100% context left "

View File

@@ -0,0 +1,5 @@
---
source: tui/src/bottom_pane/footer.rs
expression: terminal.backend()
---
" tab to queue message 100% context left "

View File

@@ -1,5 +0,0 @@
---
source: tui/src/bottom_pane/footer.rs
expression: terminal.backend()
---
" 100% context left "

View File

@@ -1,5 +0,0 @@
---
source: tui/src/bottom_pane/footer.rs
expression: terminal.backend()
---
" 100% context left · tab to queue message "

View File

@@ -2,4 +2,4 @@
source: tui/src/bottom_pane/footer.rs
expression: terminal.backend()
---
" 123K used · ? for shortcuts "
" ? for shortcuts 123K used "

View File

@@ -2,4 +2,4 @@
source: tui/src/bottom_pane/footer.rs
expression: terminal.backend()
---
" 100% context left · ? for shortcuts "
" Plan mode (shift+tab to cycle) "

View File

@@ -2,4 +2,4 @@
source: tui/src/bottom_pane/footer.rs
expression: terminal.backend()
---
" 100% context left · ? for shortcuts Plan mode "
" ? for shortcuts · Plan mode 100% context left "

View File

@@ -2,4 +2,4 @@
source: tui/src/bottom_pane/footer.rs
expression: terminal.backend()
---
" 100% context left · ? for shortcuts Plan mode (shift+tab to cycle) "
" ? for shortcuts · Plan mode (shift+tab to cycle) 100% context left "

View File

@@ -2,4 +2,4 @@
source: tui/src/bottom_pane/footer.rs
expression: terminal.backend()
---
" 72% context left · ? for shortcuts "
" ? for shortcuts 72% context left "

View File

@@ -2,4 +2,4 @@
source: tui/src/bottom_pane/footer.rs
expression: terminal.backend()
---
" 100% context left · ? for shortcuts "
" ? for shortcuts 100% context left "

View File

@@ -7,4 +7,4 @@ expression: "render_snapshot(&pane, area)"
Ask Codex to do anything
100% context left · ? for shortcuts
? for shortcuts 100% context left

View File

@@ -7,4 +7,4 @@ expression: "render_snapshot(&pane, area)"
Ask Codex to do anything
100% context left · ? for sh
100% context left

View File

@@ -9,4 +9,4 @@ expression: "render_snapshot(&pane, area)"
Ask Codex to do anything
100% context left · ? for shortcuts
? for shortcuts 100% context left

View File

@@ -7,4 +7,4 @@ expression: "render_snapshot(&pane, area)"
Ask Codex to do anything
100% context left · ? for shortcuts
? for shortcuts 100% context left

View File

@@ -11,4 +11,4 @@ expression: "render_snapshot(&pane, area)"
Ask Codex to do anything
100% context left · ? for shortcuts
? for shortcuts 100% context left