Skip to content

feat(tui): priority-ordered footer hint dropping for narrow terminals - #107

Merged
Hmbown merged 1 commit into
feat/v0.6.3from
feat/issue-88-footer-collapse
Apr 26, 2026
Merged

feat(tui): priority-ordered footer hint dropping for narrow terminals#107
Hmbown merged 1 commit into
feat/v0.6.3from
feat/issue-88-footer-collapse

Conversation

@Hmbown

@Hmbown Hmbown commented Apr 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Rework FooterWidget::status_line_spans to use priority-ordered hint dropping so the footer never wraps mid-hint at any terminal width.
  • Mode label + model name are always visible; the status label (e.g. "working", "refreshing context") drops first; the model only ellipsizes after status has already been dropped.
  • Add tier-by-tier tests at widths 40, 60, 80, 100, 120 covering the full / drop-status / truncate-model / mode-only fallback tiers.

Fixes #88

Test plan

  • cargo fmt --all -- --check
  • cargo clippy -p deepseek-tui --all-targets --all-features --locked -- -D warnings
  • cargo test -p deepseek-tui --bin deepseek-tui --locked (1001 passed, 0 failed)
  • Resize terminal between 40 and 120 cols and confirm the footer never wraps to a second row

Open in Devin Review

Rework `FooterWidget::status_line_spans` so the footer never wraps
mid-hint at any width. Hints now drop in priority order:

1. mode label (always visible; truncated only as a last resort)
2. model name (always visible alongside mode; truncated mid-word only
   after status has already been dropped)
3. status label ("working", "draft", "refreshing context", ...) — drops
   first when space is tight

Previously the model name would ellipsize the moment a long status
label crowded the line, even at 60–80 columns. The new tier system
keeps mode + model intact down to ~25 cols and only falls back to
mode-only on extreme narrow widths.

Includes snapshot-style tests at widths 40, 60, 80, 100, 120 covering
the full / drop-status / truncate-model / mode-only tiers.

Fixes #88

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request refactors the TUI footer's status line to implement a priority-ordered dropping mechanism, ensuring the footer remains on a single line across various widths. The logic prioritizes the mode label, followed by the model name, and finally the status label. A new helper method build_status_line_spans was introduced to consolidate span creation, and extensive unit tests were added to verify the truncation behavior at different column widths. One improvement was identified regarding an unnecessary heap allocation when rendering the mode label.

Comment on lines 317 to 320
return vec![Span::styled(
truncate_to_width(mode_label, max_width),
mode_label.to_string(),
Style::default().fg(self.props.mode_color),
)];

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.

medium

mode_label is a &'static str. Since Span::styled can accept it directly to produce a Span<'static>, calling .to_string() here is an unnecessary heap allocation in the render loop.

Suggested change
return vec![Span::styled(
truncate_to_width(mode_label, max_width),
mode_label.to_string(),
Style::default().fg(self.props.mode_color),
)];
return vec![Span::styled(
mode_label,
Style::default().fg(self.props.mode_color),
)];

@devin-ai-integration devin-ai-integration Bot left a comment

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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@Hmbown
Hmbown merged commit 9dd4f65 into feat/v0.6.3 Apr 26, 2026
2 checks passed
@Hmbown
Hmbown deleted the feat/issue-88-footer-collapse branch May 1, 2026 02:01
MMMarcinho pushed a commit to MMMarcinho/DeepSeek-TUI that referenced this pull request May 6, 2026
feat(tui): priority-ordered footer hint dropping for narrow terminals
timothybrush pushed a commit to timothybrush/DeepSeek-TUI that referenced this pull request Aug 16, 2026
Privileged release workflows no longer attach rust-cache, sccache, or
npm caches to a workflow_dispatch checkout (CodeQL Hmbown#88-Hmbown#106). Catalog
drift no longer prints raw bundled/upstream blobs (Hmbown#107).
Hmbown pushed a commit that referenced this pull request Aug 17, 2026
All 19 open actions/cache-poisoning/poisonable-step alerts (#88-#106) sit in
release.yml, release-candidate.yml and release-artifacts.yml: jobs interpolated
the caller SHA into ref/caches and let setup-node's implicit npm cache key on
run identity. Now caller source_sha is pinned against github.sha by a pin job
(refusing any retarget), checkout and build identity use GITHUB_SHA through
env indirection instead of template interpolation, rust-cache keys use stable
prefix-key values, and setup-node's implicit package cache is off where it
cannot be keyed safely.

Also carries the CodeQL #107 fix from the same lane: catalog_models_dev.py
prints remote limit values as numbers/null/redacted only and drops query and
fragment material from source URLs before logging.

Harvested from #5401 (workflow+script files; CHANGELOG edit intentionally
excluded here and lands with the release branch; GHSA advisory text split to
a later PR as advised).

No-Issue: CodeQL alert remediation (alerts #88-#107); no single user-facing issue tracks these

Signed-off-by: Hunter Bown <hunter@hmbown.com>
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.

1 participant