Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

[BUG-228841] Enable color output in Windows viewer debug console #6829

Open
sl-service-account opened this issue May 29, 2020 · 3 comments
Open

Comments

@sl-service-account
Copy link

sl-service-account commented May 29, 2020

The Windows 10 console can support color output, if set to the appropriate mode. Set that mode when creating the viewer's debug console.

Attachments

Original Jira Fields
Field Value
Issue BUG-228841
Summary Enable color output in Windows viewer debug console
Type New Feature Request
Priority Unset
Status Accepted
Resolution Unresolved
Reporter Nat Linden (nat.linden)
Created at 2020-05-29T21:10:56Z
Updated at 2020-06-03T15:47:14Z
{
  'Build Id': 'unset',
  'Business Unit': ['Platform'],
  'Date of First Response': '2020-05-30T08:14:23.219-0500',
  'How would you like the feature to work?': 'Enabling the Windows debug console displays messages in color.',
  'ReOpened Count': 0.0,
  'Severity': 'Unset',
  'Target Viewer Version': 'viewer-development',
  'Why is this feature important to you? How would it benefit the community?': 'Output on the Windows debug console would regain parity with the Mac console log, which can display colors.',
}
@sl-service-account
Copy link
Author

Chorazin Allen commented at 2020-05-30T13:14:23Z

How-to, based on changes made in Kokua:-

In llerror.cpp

  • Extend the #!LL_WINDOWS near line 40 with an #else and #include <io.h> for Windows only

  • Take out the platform tests in checkANSI() so that the code runs on Windows too, the return FALSE becomes surplus too

     

    In llappviewerwin32.cpp

  • Make sure that ENABLE_VIRTUAL_TERMINAL_PROCESSING is defined just after setting MAX_CONSOLE_LINES

    • const S32 MAX_CONSOLE_LINES = 500;
      // Only defined in newer SDKs than we currently use
      #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
      #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 4
      #endif
  • Extend all three of the stream opening/redirecting clauses with this code after each setvbuf

    • DWORD dwMode = 0;

    • GetConsoleMode((HANDLE)l_std_handle, &dwMode);

    • dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;

    • SetConsoleMode((HANDLE)l_std_handle, dwMode);

      Background note - from Windows 10, the console window gained colour compatibility. Now that the official target is Windows 10 plus, it's safe to make this standard behaviour.

       

       

@sl-service-account
Copy link
Author

Ansariel Hiller commented at 2020-06-01T13:12:34Z, updated at 2020-06-01T13:15:06Z

The new Windows terminal also supports emojis - maybe we should add some of those as well, e.g. a sad emoji when the viewer crashed...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant