Skip to content

feat: compact segments in the footer when they don't fit the screen#264

Open
michal-kopczynski wants to merge 4 commits into
masterfrom
LLM-1606-footer-in-is-not-responsive-elements-overflow-instead-of-wrapping
Open

feat: compact segments in the footer when they don't fit the screen#264
michal-kopczynski wants to merge 4 commits into
masterfrom
LLM-1606-footer-in-is-not-responsive-elements-overflow-instead-of-wrapping

Conversation

@michal-kopczynski
Copy link
Copy Markdown
Contributor

@michal-kopczynski michal-kopczynski commented May 15, 2026

Closes #LLM-1606

When everything fits
image

Compacting steps:
image

image image image

When the screen is very narrow and compacted elements doesn't fit they are truncated:
image


Kimchi Summary

What changed

Added responsive compaction to the status footer so it gracefully narrows for smaller terminals instead of overflowing. When space is constrained, the footer progressively abbreviates labels, drops decorative prefixes, and strips shortcut hints before falling back to tail truncation.

Why

The footer previously overflowed when terminal width was insufficient, causing elements to run off-screen. This makes the footer readable in narrow terminals or split-pane layouts.

Key changes

  • src/components/footer.ts: Replaced fixed string concatenation with a Segment-based layout engine (layoutFooter, renderLine) that applies an ordered UX-ladder of CompactionSteps.
  • src/components/footer.ts: Each footer segment now carries a stable SegmentId and optional raw inputs, enabling type-safe rebuilds during compaction without re-parsing ANSI.
  • src/components/footer.ts: Added compact-form builders buildContextCompact (drops bar, keeps N% ctx), buildMultiModelAbbrev (multi-model:m-m:), and buildPhaseCompact (drops phase: prefix).
  • src/components/footer.ts: Added SHORTCUT_TAIL regex and stripShortcutHintsAcross to remove trailing shortcut hints (e.g. → shift+tab) from permissions and multi-model segments.
  • src/components/footer.ts: Added dropFermentPrefix to slice off the ferment: label in place when space is constrained.
  • src/components/footer.test.ts: Added comprehensive behavioral tests rendering the footer at widths 160, 100, 60, 20, 10, plus regression tests for orphan separators, info lines, and shortcut-tail regex matching.

Impact

  • Footer width is now strictly bounded by the terminal width; it will never overflow.
  • No breaking changes or migration steps required. At generous widths the rendered output remains identical.

@kimchi-review
Copy link
Copy Markdown

kimchi-review Bot commented May 15, 2026

Kimchi Code Review

Property Value
Commit f40977f
Author @michal-kopczynski
Files changed 0
Review status Completed
Comments 0
Duration 91s

Summary

📊 Review Score: 92/100 (overall code quality — 0 lowest, 100 highest)
⏱️ Estimated effort to review: 3/5 (1 = trivial, 5 = very complex)

🧪 Tests: yes — Extensive test coverage added (621 lines) exercising compaction builders, regex matching, behavioral acceptance at representative terminal widths (160 down to 10), CJK/wide-character handling, segment visibility toggles, info-line layout, and a regression test against orphan separators. Tests are well-structured and validate the UX-ladder truncation strategy.

No significant issues found. LGTM! 🎉

What to expect

Kimchi will analyze the changes in this pull request and post:

  • A summary of the overall changes
  • Inline comments on specific lines with findings categorized by issue type

The review typically completes within a few minutes. This comment will be updated once the review is ready.

Interact with Kimchi
  • @kimchi review — re-trigger a full review on the latest commit
  • @kimchi summary — regenerate the PR summary
  • @kimchi ignore — skip this PR (no review will be posted)
  • Reply to any inline comment to ask follow-up questions or request clarification
Configuration

Reviews are configured by your organization admin.
Review instructions, excluded directories, and severity thresholds can be adjusted per repository in the Kimchi dashboard.


Powered by Kimchi — AI-powered code review by CAST AI

Copy link
Copy Markdown

@kimchi-review kimchi-review Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Review Score: 88/100 (overall code quality — 0 lowest, 100 highest)
⏱️ Estimated effort to review: 3/5 (1 = trivial, 5 = very complex)

🧪 Tests: yes — Thorough test coverage added: unit tests for all compact-form builders, regex validation for SHORTCUT_TAIL, behavioural acceptance tests across 14 representative terminal widths, and regression tests for info-line rendering and orphan separators.

📝 Found 2 issue(s). See inline comments for details.

Comment thread src/components/footer.ts
Comment thread src/components/footer.test.ts
@michal-kopczynski
Copy link
Copy Markdown
Contributor Author

@kimchi review

@kimchi-review
Copy link
Copy Markdown

kimchi-review Bot commented May 15, 2026

🔄 Starting review on f40977f
Triggered by @michal-kopczynski via the command.

@michal-kopczynski michal-kopczynski marked this pull request as ready for review May 15, 2026 18:41
@readme-ai-writer
Copy link
Copy Markdown

readme-ai-writer Bot commented May 15, 2026

📚 No documentation changes were needed for this PR (Job ID: 6a0768f4bf7c12ca6240a928).

Copy link
Copy Markdown

@kimchi-review kimchi-review Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Review Score: 92/100 (overall code quality — 0 lowest, 100 highest)
⏱️ Estimated effort to review: 3/5 (1 = trivial, 5 = very complex)

🧪 Tests: yes — Extensive test coverage added (621 lines) exercising compaction builders, regex matching, behavioral acceptance at representative terminal widths (160 down to 10), CJK/wide-character handling, segment visibility toggles, info-line layout, and a regression test against orphan separators. Tests are well-structured and validate the UX-ladder truncation strategy.

No significant issues found. LGTM! 🎉


describe("compact-form builders", () => {
describe("buildContextCompact", () => {
it("returns `N% ctx` with no bar", () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt we need that much unit testing here. This is easily testable manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants