Skip to content

fix: spacing for right and center aligned text in tableCustom - #99

Closed
jackson-stone-fs wants to merge 2 commits into
node-escpos:mainfrom
aiden-loyd-fs:fix-tablecustom-spacing
Closed

fix: spacing for right and center aligned text in tableCustom#99
jackson-stone-fs wants to merge 2 commits into
node-escpos:mainfrom
aiden-loyd-fs:fix-tablecustom-spacing

Conversation

@jackson-stone-fs

@jackson-stone-fsjackson-stone-fs commented Oct 9, 2024

Copy link
Copy Markdown

fix#62

This PR aims to fix misalignment in certain circumstances when using center and right aligned text. Because the floor of the number of spaces the column had available wasn't taken for right and center as it was for left, these columns had a tendency to overflow and cause extra newlines.

This is fixed by taking the floor of cellWidth - textLength for right aligned text, and handling fractional components by taking the ceiling for the left side and floor for the right side for center aligned text. This keeps the previous convention of preferring extra space on the left instead of right for center aligned text.

An example of bad parameters that would cause issues before this PR for testing purposes is cellWidth = 4.2 and textLength = 2.

@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9a3e957

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@node-escpos/corePatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dosubotdosubotBot added the size:S This PR changes 10-29 lines, ignoring generated files. label Oct 9, 2024
@jackson-stone-fs

Copy link
Copy Markdown
Author

Closing in order to transfer ownership to @aiden-loyd-fs

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

Labels

size:SThis PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Table items are not aligned

1 participant

@jackson-stone-fs