{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/console/issues/78","repository_url":"https://api.github.com/repos/Microsoft/console","labels_url":"https://api.github.com/repos/Microsoft/console/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/console/issues/78/comments","events_url":"https://api.github.com/repos/Microsoft/console/issues/78/events","html_url":"https://github.com/Microsoft/console/issues/78","id":297650895,"number":78,"title":"ANSI/VT \\e[7m and \\e[27m (reverse/negative) do not work correctly after 24-bit color has been used","user":{"login":"bitcrazed","id":961950,"avatar_url":"https://avatars1.githubusercontent.com/u/961950?v=4","gravatar_id":"","url":"https://api.github.com/users/bitcrazed","html_url":"https://github.com/bitcrazed","followers_url":"https://api.github.com/users/bitcrazed/followers","following_url":"https://api.github.com/users/bitcrazed/following{/other_user}","gists_url":"https://api.github.com/users/bitcrazed/gists{/gist_id}","starred_url":"https://api.github.com/users/bitcrazed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitcrazed/subscriptions","organizations_url":"https://api.github.com/users/bitcrazed/orgs","repos_url":"https://api.github.com/users/bitcrazed/repos","events_url":"https://api.github.com/users/bitcrazed/events{/privacy}","received_events_url":"https://api.github.com/users/bitcrazed/received_events","type":"User","site_admin":false},"labels":[{"id":838733506,"url":"https://api.github.com/repos/Microsoft/console/labels/console","name":"console","color":"111111","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-16T01:01:16Z","updated_at":"2018-05-06T13:49:39Z","closed_at":"2018-05-03T17:58:43Z","author_association":"CONTRIBUTOR","body":"_From @PhMajerus on October 20, 2017 18:23_\n\nConcerns Redstone 3 RTW / Windows 10 ver. 1709, tested on build 16299.19. Affects all WSL distros and more broadly, all Win32 CUI apps using VT.\r\n\r\nVT escape control sequences \"\\x1B[7m\" and \"\\x1B[27m\" are used to turn reverse video (\"negative\", but not technically negative) on and off.\r\nThey work fine until the console processed a 24-bit color \"\\x1B[38;2;r;g;bm\" or \"\\x1B[48;2;r;g;bm\". At that point, negative off (27) has no effect or even acts erratically, even if the color has been reset (\"\\x1B[39m\", set back to a base 16 color (\\x1B[3(0-9)m\"), or if SGR has been reset (\"\\x1B[m\") in the meantime.\r\n\r\n`echo -e \"\\e[7m Reversed \\e[27m Normal \\e[38;2;250;20;40m 24-bit \\e[36m 16-colors \\e[7m Reversed \\e[27m Normal \\e[39m Default \\e[7m Reversed \\e[27m Normal \\e[m Reset \\e[7m Reversed \\e[27m Normal\"`\r\n\r\n![vt reverse bug ubuntu rtw](https://user-images.githubusercontent.com/25664275/31836014-1e87339a-b5d4-11e7-880b-e185be2d9aa8.png)\r\n\r\nThis is a bug in conhost that affects all Windows CUI apps that uses VT, as the following repro code shows:\r\n```\r\n#include <windows.h>\r\n\r\n#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING\r\n#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004\r\n#endif\r\n\r\nint main()\r\n{\r\n\tHANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);\r\n\t\r\n\tDWORD dwMode = 0;\r\n\tGetConsoleMode(hOutput, &dwMode);\r\n\tdwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;\r\n\tSetConsoleMode(hOutput, dwMode);\r\n\t\r\n\tLPTSTR pszTestString = TEXT(\"\\x1B[7m Reversed \\x1B[27m Normal \\x1B[38;2;128;5;255m Set 24-bit foreColor \\x1B[7m Reversed \\x1B[27m Normal \\r\\n\");\r\n\tWriteConsole(hOutput, pszTestString, _tcslen(pszTestString), NULL, NULL);\r\n\t\r\n\tgetchar();\r\n\treturn 0;\r\n}\r\n```\r\n![reversevideo app](https://user-images.githubusercontent.com/25664275/31836497-cfd50ea0-b5d5-11e7-92da-f84a47d9c77d.png)\r\n\r\nCalling SetConsoleScreenBufferInfoEx or showing and OK'ing the console's properties dialog seems to reset the issue until next time 24-bit color is used.\r\n\n\n_Copied from original issue: Microsoft/WSL#2583_"},"comment":{"url":"https://api.github.com/repos/Microsoft/console/issues/comments/386880757","html_url":"https://github.com/Microsoft/console/issues/78#issuecomment-386880757","issue_url":"https://api.github.com/repos/Microsoft/console/issues/78","id":386880757,"user":{"login":"PhMajerus","id":25664275,"avatar_url":"https://avatars3.githubusercontent.com/u/25664275?v=4","gravatar_id":"","url":"https://api.github.com/users/PhMajerus","html_url":"https://github.com/PhMajerus","followers_url":"https://api.github.com/users/PhMajerus/followers","following_url":"https://api.github.com/users/PhMajerus/following{/other_user}","gists_url":"https://api.github.com/users/PhMajerus/gists{/gist_id}","starred_url":"https://api.github.com/users/PhMajerus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhMajerus/subscriptions","organizations_url":"https://api.github.com/users/PhMajerus/orgs","repos_url":"https://api.github.com/users/PhMajerus/repos","events_url":"https://api.github.com/users/PhMajerus/events{/privacy}","received_events_url":"https://api.github.com/users/PhMajerus/received_events","type":"User","site_admin":false},"created_at":"2018-05-06T13:49:39Z","updated_at":"2018-05-06T13:49:39Z","author_association":"NONE","body":"@bitcrazed Challenge accepted:\r\necho -e \"\\e[31m1\\e[7m2\\e[44m3\\e[49m4\\e[27m5\\e[m\"\r\necho -e \"\\e[38;2;250;20;40m 24-bit used \\e[m\"\r\necho -e \"\\e[31m1\\e[7m2\\e[44m3\\e[49m4\\e[27m5\\e[m\"\r\n![vt 24bit rs4 rtw bug](https://user-images.githubusercontent.com/25664275/39673934-ff8e098e-5144-11e8-94f1-634c4617a731.png)\r\n"}}
{"actor":{"display_login":"PhMajerus"}}