Skip to content

WIP: Fix Format-Table/Format-Wide padding when output contains CJK characters - #5739

Closed
kwkam wants to merge 9 commits into
PowerShell:masterfrom
kwkam:tabcomp_cjk
Closed

kwkam wants to merge 9 commits into
PowerShell:masterfrom
kwkam:tabcomp_cjk

Conversation

@kwkam

@kwkam kwkam commented Dec 22, 2017 •

Copy link
Copy Markdown
Contributor

PR Summary

Compute display width for the string in LengthInBufferCells, otherwise Format-Table and Format-Wide will pad unnecessary space for CJK character.

Add UTF-8 to checking list since it contains CJK characters.

PR Checklist

Note: Please mark anything not applicable to this PR NA.

Solve an issue where CJK characters are not being rendered with
correct width while tab completion is cycling multiple results,
caused by reusing a buffer without resetting lead/trail attribute.
Also add UTF-8 to checking list since it contains CJK characters.
@iSazonov

Copy link
Copy Markdown
Collaborator

kwkam Thanks for your contribution! Please follow the requirements of PR Checklist.

@lzybkr

Copy link
Copy Markdown
Contributor

kwkam - This might be fixed in the PSReadLine repo. You can install v2 from the gallery.

I think the version in this repo will be removed in favor of pulling my version from the gallery, so if you still see issues, I suggest you submit a PR there instead.

The change to ConsoleControl.cs does make sense in this repo though, so we should merge that for sure.

@kwkam kwkam changed the title console: fix cjk char render on tab completion Console: Fix CJK char render when using UTF-8 output encoding Dec 23, 2017
@kwkam

kwkam commented Dec 23, 2017

Copy link
Copy Markdown
Contributor Author

Jason Shirk (@lzybkr) - Sorry I didn't know PSReadLine is an external module and yes the issue is fixed in upstream.

escapeSequenceAdjustment += ControlSequenceLength(str, ref i);
}
}
#if !UNIX

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a problem on Linux/Mac as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose but I cannot test.
Is there any reason why the LengthInBufferCells function is disabled on unix?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know for sure, but I would guess the original code depended on Windows apis and when porting to non-Windows, they punted on porting that code until a later time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exlcuding LengthInBufferCells from that block since it seems to be harmless.

@kwkam kwkam changed the title Console: Fix CJK char render when using UTF-8 output encoding Fix Format-Table/Format-Wide padding when output contains CJK characters Mar 16, 2018
@kwkam kwkam changed the title Fix Format-Table/Format-Wide padding when output contains CJK characters WIP: Fix Format-Table/Format-Wide padding when output contains CJK characters Mar 16, 2018
@stale

stale Bot commented May 12, 2018

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 10 days.
Thank you for your contributions.
Community members are welcome to grab these works.

@stale stale Bot added the Stale label May 12, 2018
@stale

stale Bot commented May 22, 2018

Copy link
Copy Markdown

This PR has be automatically close because it is stale. If you wish to continue working on the PR, please first update the PR, then reopen it.
Thanks again for your contribution.
Community members are welcome to grab these works.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants