Skip to content

ellipsis_truncate: pad a truncated string to the full width (1.4-maint) - #10481

Merged
ThomasWaldmann merged 1 commit into
borgbackup:1.4-maintfrom
ThomasWaldmann:ellipsis-truncate-pad-1.4
Oct 3, 2026
Merged

ThomasWaldmann merged 1 commit into
borgbackup:1.4-maintfrom
ThomasWaldmann:ellipsis-truncate-pad-1.4

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Description

Backport of #10480.

ellipsis_truncate() pads a short string to the given width, but it did not pad a truncated one. swidth_slice() does not split a wide (e.g. CJK) character, so each of the two slices around the ... can be one cell short, and the truncated result could be up to 2 cells narrower than requested.

borg create --progress and borg extract --progress (which uses ellipsis_truncate() in ProgressIndicatorPercent on 1.4) repaint their line with a carriage return and rely on that padding to overwrite the previous line. With wide characters in the paths, the end of a longer previous line stayed visible, e.g. pwide/日...い名前_2.txtt.

The truncated string is now padded like the short one.

Checklist

  • PR is against master (or maintenance branch if only applicable there)
  • New code has tests and docs where appropriate
  • Tests pass (run tox or the relevant test subset)
  • Commit messages are clean and reference related issues

🤖 Generated with Claude Code

swidth_slice does not split a wide (e.g. CJK) character, so each of the two
slices around the "..." can be one cell short of its width. The truncated
result was then up to 2 cells narrower than the space, and nothing padded it.

borg create --progress and borg extract --progress repaint their line with a
carriage return and rely on the padding to overwrite the previous line: with
wide characters in the paths, the last characters of a longer previous line
stayed visible.

Backport of borgbackup#10480.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.10%. Comparing base (084f3fb) to head (c13c9ee).
⚠️ Report is 1 commits behind head on 1.4-maint.

Additional details and impacted files
@@              Coverage Diff              @@
##           1.4-maint   #10481      +/-   ##
=============================================
- Coverage      82.11%   82.10%   -0.01%     
=============================================
  Files             38       38              
  Lines          11479    11480       +1     
  Branches        1808     1808              
=============================================
  Hits            9426     9426              
- Misses          1467     1468       +1     
  Partials         586      586              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann
ThomasWaldmann merged commit 008a520 into borgbackup:1.4-maint Oct 3, 2026
14 of 15 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the ellipsis-truncate-pad-1.4 branch October 3, 2026 21:55
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