fix: wrap long text on multiple rows#216
fix: wrap long text on multiple rows#216v-alexmoraru wants to merge 12 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Improves print_output_format table rendering in unix-style output by wrapping long cell values across multiple lines and introducing terminal-width-aware column sizing to prevent misaligned/off-screen output.
Changes:
- Added text wrapping and multi-line row rendering for unix-style tables.
- Introduced terminal-width-based column width capping to keep tables within the visible viewport.
- Updated test harness/recordings and added a changelog entry for the fix.
Reviewed changes
Copilot reviewed 22 out of 157 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_commands/recordings/test_commands/test_jobs/test_run_schedule_rm_success[SparkJobDefinition].yaml | Updated recorded HTTP interactions affected by output formatting/version changes. |
| tests/test_commands/recordings/test_commands/test_jobs/test_run_schedule_rm_invalid_param_types_failure.yaml | Updated recorded HTTP interactions affected by output formatting/version changes. |
| tests/test_commands/recordings/test_commands/test_jobs/test_run_sch_notebook_no_params_failure.yaml | Updated recorded HTTP interactions affected by output formatting/version changes. |
| tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook_timeout_zero_sec.yaml | Updated recorded HTTP interactions affected by output formatting/version changes. |
| tests/test_commands/recordings/test_commands/test_jobs/test_run_job_notebook.yaml | Updated recorded HTTP interactions affected by output formatting/version changes. |
| tests/test_commands/recordings/test_commands/test_jobs/test_job_run_failure_with_timeout_exits_with_code_1_success.yaml | Updated recorded HTTP interactions affected by output formatting/version changes. |
| tests/test_commands/recordings/test_commands/test_jobs/test_job_run_exits_with_code_1_success.yaml | Updated recorded HTTP interactions affected by output formatting/version changes. |
| tests/test_commands/recordings/test_commands/test_jobs/class_setup.yaml | Updated recorded setup interactions (User-Agent, IDs, etc.) aligning with new runs/version. |
| tests/conftest.py | Forces a wide terminal in tests to avoid truncation from new column-width capping logic. |
| src/fabric_cli/utils/fab_ui.py | Implements wrapping + multi-line printing and caps column widths to terminal size. |
| .changes/unreleased/fixed-20260427-142055.yaml | Adds changelog entry for wrapping long text across multiple lines. |
Co-authored-by: Copilot <copilot@github.com>
| if header: | ||
| widths = [ | ||
| max(len(field), max(get_visual_length(entry, field) for entry in _entries)) | ||
| max( |
There was a problem hiding this comment.
there is a new function recently added - fab_utils.truncate_columns maybe you can try reuse it to fix the issue
There was a problem hiding this comment.
The existing truncate method hides the overflowing text behind .... The approach I used adds it on a new line below, so that no text is hidden. I think it's cleaner to keep it this way
When
print_output_formatrendered a table withshow_headers=Trueand long column values, rows exceeded the terminal width causing headers and values to appear misaligned or off-screen._wrap_texthelper that splits text into lines respecting visual width_format_unix_style_fieldand_format_unix_style_entryto return list[str] — one line per wrapped row — instead of a single potentially overflowing stringprint_entries_unix_styleto cap column widths proportionally to fit the terminal and print each new row