Skip to content

fix(search): show previews for commands truncated by custom columns#3601

Open
ychampion wants to merge 1 commit into
atuinsh:mainfrom
ychampion:fix-preview-height-custom-columns
Open

fix(search): show previews for commands truncated by custom columns#3601
ychampion wants to merge 1 commit into
atuinsh:mainfrom
ychampion:fix-preview-height-custom-columns

Conversation

@ychampion

Copy link
Copy Markdown

Summary

  • derive the visible command width from the configured result columns
  • cover the reported custom-column layout with a preview-height regression

Why

The auto strategy still assumed the default 19-cell prefix. With datetime and exit columns enabled, the selected command can be truncated even though the preview calculation thinks it fits.

Fixes #3599.

Validation

  • cargo test -p atuin --no-default-features --features client calc_preview_height -- --nocapture - passed (2 tests)
  • cargo test -p atuin --no-default-features --features client --bin atuin - passed (200 tests)
  • cargo clippy -p atuin --no-default-features --features client --bin atuin -- -D warnings -A unused-variables - passed
  • cargo fmt --all -- --check - passed

Checks

  • I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle
  • I have checked that there are no existing pull requests for the same thing

Constraint: Preview visibility must use the same fixed and expanding column model as the result list.
Confidence: high
Scope-risk: narrow
Directive: Keep preview visibility width calculations aligned with result-column layout changes.
Tested: client-only atuin unit tests, focused preview tests, Clippy, rustfmt, and git diff checks.
Not-tested: full default-feature workspace suite due local disk limits.
@github-actions

Copy link
Copy Markdown
Contributor

Fossier: Manual Review Requested

@ychampion is a new contributor. A maintainer should review this PR before merging.

Score Breakdown

Total Score: 60.4/100 | Confidence: 100% | Outcome: REVIEW

Signal Value Score Weight
account_age 2191 1.00 0.09
public_repos 63 1.00 0.05
contribution_history 67 0.34 0.05
follower_ratio 1.2 0.60 0.05
bot_signals False 0.50 0.04
open_prs_elsewhere 49 0.00 0.09
closed_prs_elsewhere 5 0.50 0.10
merged_prs_elsewhere 21 1.00 0.08
prior_interaction 0 0.00 0.08
activity_velocity 1 1.00 0.08
pr_content ... 1.00 0.08
commit_email no_email 0.50 0.04
pr_description ... 0.70 0.05
repo_stars 30510 0.30 0.04
org_membership 0 0.20 0.03
commit_verification ... 0.30 0.04
contributor_stars 74 1.00 0.04

@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes incorrect preview-height calculation when users configure extra UI columns (datetime, exit, etc.). The old code subtracted a hardcoded 19-cell prefix (duration + time + indicator) when deciding whether the selected command is truncated; extra columns were invisible to this calculation, so the preview was never shown for commands that were actually cut off.

  • command_column_width now sums the widths of all non-expanding columns plus the indicator, and subtracts that from the available width, matching the actual column layout.
  • The existing regression test uses the default columns and still passes; a new test covers the reported five-column layout at width 60.

Confidence Score: 5/5

Safe to merge — the change is isolated to preview height calculation and has no effect on data or history storage.

The fix replaces a hardcoded constant with a dynamic computation that correctly accounts for all configured columns. The math reproduces the original behaviour with default columns, the new test covers the reported scenario, and there are no side effects outside the display path.

No files require special attention.

Important Files Changed

Filename Overview
crates/atuin/src/command/client/search/interactive.rs Adds command_column_width helper that computes the visible command column width from configured UiColumn settings instead of the hardcoded 19-cell constant; updates calc_preview_height to use it and adds a regression test for the custom-column layout.

Reviews (1): Last reviewed commit: "Ensure auto previews follow configured r..." | Re-trigger Greptile

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: show_preview=true does not always show preview

1 participant