Skip to content

[LiveLogger] Fix error and warning message alignment #8719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2023

Conversation

ladipro
Copy link
Member

@ladipro ladipro commented May 2, 2023

Context

The error and warning symbols may be rendered with different width on some terminals, resulting in misaligned output.

Changes Made

To make sure that the message text is always aligned we

  1. Print the symbol.
  2. Move back to the start of the line.
  3. Move forward to the desired column.
  4. Print the message text.

Testing

Windows terminal:

image

Windows cmd:

image

Fedora terminal:

image

Notes

I've also tried saving & restoring cursor position (VT100 functions 7 and 8) but that didn't fully work on Windows. The red X was still off.

@rokonec
Copy link
Member

rokonec commented May 2, 2023

These changes might trigger needs to retest it on other terminals. However, I believe that moving cursors is basic VT100 functionality and all mature terminals implements it properly.
Oh, did I mention I really like this idea of alignment enforcement/fix?

@ladipro ladipro added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label May 4, 2023
@JaynieBai JaynieBai merged commit ab69595 into dotnet:main May 5, 2023
@ladipro ladipro deleted the tl-align-messages branch May 10, 2023 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants