You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: wrap KOT item descriptions and comments to prevent comment overlay - #1462
some one reported: The comment in the kitchen receipt is overlaying over the item description , check, investigate and fix.
What Changed
Wrap long KOT item headings and special_instructions comments across indented continuation lines instead of truncating them in main/printers/document-kot.ts (via pushWrappedShapedLine) and frontend/src/lib/printer/kot-encoder.ts.
Align sourceLines and sourceControlLines tracking with wrapped KOT item rows and keep indented continuation lines in the same semanticLineGroups entry so raster fallback renders item descriptions and comments as separate requests without style bleed.
Reset active ESC/POS bold state (ESC E 0) in buildEscPos when transitioning from bold item lines to normal lines, flush banner newlines before resetting text size in buildKotBytes, and add explicit line-height: 1.4 and top margins to web KOT item/addon/comment rows in generateKotHtml.
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
Prevent KOT comments from overlapping long item descriptions
🐞 Bug fix🧪 Tests🕐 40+ Minutes
AI Description
• Wrap long KOT item headings and comments instead of truncating them on thermal receipts.
• Keep wrapped raster lines grouped correctly and reset print styles before comments.
• Increase web-print line spacing and add regression coverage across print paths.
Diagram
graph TD
O(["KOT order"]) --> D["Document renderer"] --> W["Wrapped lines"] --> E["ESC POS bytes"]
D --> G["Raster grouping"] --> R["Raster requests"]
O --> F["Frontend encoder"] --> E
O --> H["Web print HTML"]
Loading
High-Level Assessment
The following are alternative approaches to this PR:
1. Share a KOT row-layout formatter
➕ Could prevent the document and frontend thermal paths from diverging on wrapping rules.
➖ Would couple tokenized document output to a direct printer encoder with different shaping and rendering constraints.
Recommendation: Keep the path-specific changes for this targeted fix: the document renderer needs raster source metadata that the frontend encoder does not. A shared row-layout abstraction is worth revisiting only if future changes repeatedly require matching edits in both thermal paths.
Files changed (6) +360 / -61
Bug fix (5) +148 / -61
kot-encoder.tsWrap frontend thermal KOT headings and comments+73/-23
Wrap frontend thermal KOT headings and comments
• Prints long headings and special instructions on indented continuation lines, retaining the existing truncation path for Arabic shaping. Moves the banner newline before text-size and bold resets.
document-kot.tsWrap document KOT rows and preserve raster mappings+37/-33
Wrap document KOT rows and preserve raster mappings
• Wraps item names and comments into indented lines while collecting source and control-line metadata as each row is built. This keeps raster source ranges aligned when a heading or comment spans multiple printed lines.
formatting-helpers.tsAdd shaped-line wrapping and reset ESC/POS bold+27/-0
Add shaped-line wrapping and reset ESC/POS bold
• Adds a wrapping helper that preserves the Arabic-shaping truncation path. Tracks active ESC/POS bold state and explicitly turns it off before normal lines.
kot-order-notes.test.tsCover long KOT text across thermal, raster, and web output+212/-0
Cover long KOT text across thermal, raster, and web output
• Adds regression assertions for wrapped item and comment text, column limits, style resets, and separate raster requests. Also checks frontend thermal output and web-print line spacing.
pushWrappedShapedLine and the frontend heading loop emit every segment of a product or variant
name without a line limit. Catalog names have no length cap, so a large name copied into an order
can generate thousands of KOT lines and a correspondingly large print job instead of the previously
single-line heading.
Review mode: Auto: ⚖️ Balanced: Downgraded extended -> standard: change is below the extended eligibility bar (hunks 15/18, lines 421/200; both must reach the floor). Router rationale: Dense logic across six files: wrapping, raster grouping, ESC/POS bold state, and HTML.
Tip of the day
💡 Did you know, you can commit Qodo's fix in one click with committable suggestions (GitHub & GitLab)
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
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.
Intent
some one reported: The comment in the kitchen receipt is overlaying over the item description , check, investigate and fix.
What Changed
special_instructionscomments across indented continuation lines instead of truncating them inmain/printers/document-kot.ts(viapushWrappedShapedLine) andfrontend/src/lib/printer/kot-encoder.ts.sourceLinesandsourceControlLinestracking with wrapped KOT item rows and keep indented continuation lines in the samesemanticLineGroupsentry so raster fallback renders item descriptions and comments as separate requests without style bleed.ESC E 0) inbuildEscPoswhen transitioning from bold item lines to normal lines, flush banner newlines before resetting text size inbuildKotBytes, and add explicitline-height: 1.4and top margins to web KOT item/addon/comment rows ingenerateKotHtml.Testing
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
⏭️ **Rebase** - skipped
Step was skipped.
⏭️ **Review** - skipped
Step was skipped.
⏭️ **Test** - skipped
Step was skipped.
⏭️ **Document** - skipped
Step was skipped.
⏭️ **Lint** - skipped
Step was skipped.
⏭️ **Push** - skipped
Step was skipped.