Repository navigation
fix(print): reflow pack receipt columns for XL - #1381
Merged
Merged
Conversation
Reflow configured line-item and tax-summary column widths in selectTemplateRenderProfile when extra_large text halves the layout width so right-hand financial values stay intact instead of being clipped off the right edge. Fixes #1368
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1368
Intent
Fix the P1 release-readiness regression from PR #1358 (#1358) at main/printers/thermal.ts:2216: reflow pack columns before halving receipt width. Extra-large text halves the layout width while retaining the pack's original column widths, and the renderer then truncates entire financial columns with no warning (reproduced: quantity 2, item amount $24.68, and VAT $1.23 disappear). Recalculate configured column widths before rendering, and extend tests beyond profile selection to render the resulting receipt and verify those values appear intact.
What Changed
lineItemsandtaxSummarycolumn widths inselectTemplateRenderProfile()when enlarged text narrows the target column count below the selected profile width.pluginItemRows(),pluginLineItemColumns(), andpluginSummaryRow()so right-aligned quantities, rates, and amounts fit without truncating financial values.renderPluginReceipt(), document extra-large tax-pack column reflow indocs/architecture/printing.md, and extendtests/printer-text-size.test.tsto verify rendered receipt output preserves item quantities, rates, amounts, and tax summary values across all text sizes.Risk Assessment
✅ Low: The change cleanly reflows pack line-item and tax-summary column widths when extra-large text halves the receipt layout width, preserving normal/large layouts and verifying rendered ESC/POS output across all text sizes.
Testing
Ran the printer text-size, receipt column oracle, receipt column width, receipt printing, and bills print API suites plus a full backend build, then stood up the live Express API server with an isolated SQLite database and a local TCP ESC/POS thermal printer listener to drive preview and live network printing across 80mm (48-col) and 58mm (32-col) country-pack receipts at normal, large, and extra_large text sizes; this backend thermal ESC/POS change has no browser UI changes, and the decoded ESC/POS transcripts and cell-width measurements were captured in the evidence artifact with all checks passing.
Evidence: Live Express server and TCP network thermal printer ESC/POS receipt reflow verification transcript
=== Scenario 1: 80mm (cols-48) Pack Receipt with text_size=extra_large (halved to 24 layout cols) === API Preview Response: status=200, columns=24, warnings=[] API Live Print Response: status=200, success=true, warnings=[] TCP ESC/POS Payload: 649 bytes, measured maxCells=48/48, unconsumedControlBytes=0 Item Row: "Coffee 2 $12.34 $24.68" VAT Row: "VAT @5% $1.23" --- Full Decoded Receipt --- FLO TEST CAFE === TAX INVOICE === Invoice #: INV-20260421-0002 Date: 4/21/2026 Time: 6:30:00 AM ------------------------ ITEM QTY RATE AMOUNT ------------------------ Coffee 2 $12.34 $24.68 ------------------------ Subtotal $30.00 VAT @5% $1.23 === TOTAL $31.23 ------------------------ Cash $31.23 === Thank you! === Scenario 3 (Adversarial): 58mm (cols-32) Pack Receipt with text_size=extra_large (16 layout cols) & Long Wrapping Item + $124.68 Amount === API Preview Response: status=200, columns=16, warnings=[] API Live Print Response: status=200, success=true, warnings=[] TCP ESC/POS Payload: 710 bytes, measured maxCells=32/32, unconsumedControlBytes=0 Item First Row: "Artis 2 $124.68" VAT Row: "VAT @5% $6.23"Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
npm run test:printer-text-sizenpm run test:receipt-column-oraclenpm run test:receipt-column-widthnpm run test:receipt-printingnpm run test:bills-print-apinpm run buildLive Express API (POST /api/printers, PUT /api/printers/:id, PUT /api/settings/bill_template, POST /api/printers/print-bill) + TCP ESC/POS thermal printer socket verification across 48-col and 32-col profiles at normal, large, and extra_large text sizes✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.