Req #72768 [Opn->Asn]: Add ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for php.exe

From: Date: Fri, 05 Aug 2016 22:19:59 +0000
Subject: Req #72768 [Opn->Asn]: Add ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for php.exe
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202975@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72768&edit=1

 ID:                 72768
 Updated by:         kalle@php.net
 Reported by:        mlocati at gmail dot com
 Summary:            Add ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for
                     php.exe
-Status:             Open
+Status:             Assigned
 Type:               Feature/Change Request
 Package:            Output Control
 Operating System:   Windows 10
 PHP Version:        Irrelevant
-Assigned To:        
+Assigned To:        ab
 Block user comment: N
 Private report:     N

 New Comment:

It makes sense for me to add this flag to CLI, what do you think Anatol?


Previous Comments:
------------------------------------------------------------------------
[2016-08-05 16:38:07] mlocati at gmail dot com

Description:
------------
The standard console of newer versions of Windows 10 add support to ANSI control codes.
BTW, every console executable should explicitly tell to use that new feature with the flag
ENABLE_VIRTUAL_TERMINAL_PROCESSING.

For instance, at http://imgur.com/a/heYHm you see the the
output of the application compiled from the code at the bottom.

What about adding this flag to php.exe?



#include <windows.h>
#include <stdio.h>

#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif

int main(void) {
  const char* sampleText = "\033[101;93m Yellow text on red background \033[0m\n";
  HANDLE hStdout;
  DWORD handleMode;

  printf(sampleText);

  hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
  GetConsoleMode(hStdout, &handleMode);
  handleMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
  SetConsoleMode(hStdout, handleMode);
  printf(sampleText);

  return 0;
}




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=72768&edit=1


Thread (38 messages)

« previous php.bugs (#202975) next »