Painting issue with COMMON_LVB_UNDERSCORE in 1703 onwards #43

Open
opened 2026-01-30 21:40:29 +00:00 by claunia · 0 comments
Owner

Originally created by @dra27 on GitHub (Jan 8, 2018).

Originally assigned to: @zadjii-msft on GitHub.

COMMON_LVB_UNDERSCORE seems to paint unreliably since Windows 10 1703 (10.0.15063) and it's still present in 10.0.17063.1000 on the fast insider ring.

Compile and run the following program multiple times from a new command prompt (I've only tried it on x64 installations):

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

int main(void) {
  HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  CONSOLE_SCREEN_BUFFER_INFO info;
  GetConsoleScreenBufferInfo(hConsole, &info);
  SetConsoleTextAttribute(hConsole, COMMON_LVB_UNDERSCORE | info.wAttributes);
  printf("COMMON_LVB_UNDERSCORE added to console text attributes\n");
  fflush(stdout);
  printf("Hello world\n");
  fflush(stdout);
  SetConsoleTextAttribute(hConsole, info.wAttributes);
}

The expected output is two lines of text both underlined. On my 1703 box, the first line is never underlined and, randomly, neither was the second on one run. Scroll the console to move the lines off-screen and scroll it back and the lines reappear.

Note that you have to scroll the console text itself out of the viewport and back in - moving another window over the top of the console and then off does not cause the underlining to reappear. The effect occurs regardless of whether the program is run from the machine directly or via remote desktop.

Originally created by @dra27 on GitHub (Jan 8, 2018). Originally assigned to: @zadjii-msft on GitHub. `COMMON_LVB_UNDERSCORE` seems to paint unreliably since Windows 10 1703 (10.0.15063) and it's still present in 10.0.17063.1000 on the fast insider ring. Compile and run the following program multiple times from a new command prompt (I've only tried it on x64 installations): ```c #include <windows.h> #include <stdio.h> int main(void) { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO info; GetConsoleScreenBufferInfo(hConsole, &info); SetConsoleTextAttribute(hConsole, COMMON_LVB_UNDERSCORE | info.wAttributes); printf("COMMON_LVB_UNDERSCORE added to console text attributes\n"); fflush(stdout); printf("Hello world\n"); fflush(stdout); SetConsoleTextAttribute(hConsole, info.wAttributes); } ``` The expected output is two lines of text both underlined. On my 1703 box, the first line is never underlined and, randomly, neither was the second on one run. Scroll the console to move the lines off-screen and scroll it back and the lines reappear. Note that you have to scroll the console text itself out of the viewport and back in - moving another window over the top of the console and then off does not cause the underlining to reappear. The effect occurs regardless of whether the program is run from the machine directly or via remote desktop.
claunia added the Product-ConhostResolution-Fix-Available labels 2026-01-30 21:40:29 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#43