Skip to content
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

Painting issue with COMMON_LVB_UNDERSCORE in 1703 onwards #47

Closed
dra27 opened this issue Jan 8, 2018 · 7 comments
Closed

Painting issue with COMMON_LVB_UNDERSCORE in 1703 onwards #47

dra27 opened this issue Jan 8, 2018 · 7 comments
Assignees
Labels
Product-Conhost For issues in the Console codebase Resolution-Fix-Available It's available in an Insiders build or a release
Milestone

Comments

@dra27
Copy link

dra27 commented Jan 8, 2018

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.

@zadjii-msft
Copy link
Member

I'm gonna link Maximus5/ConEmu#1302 to this, because they definitely look related. In all likelyhood I probably messed something up with meta attributes when I added RGB color.

I'm looking into it.

@zadjii-msft zadjii-msft added Work-Item It's being tracked by an actual work item internally. (to be removed soon) Product-Conhost For issues in the Console codebase labels Jan 11, 2018
@zadjii-msft zadjii-msft added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. Resolution-Fix-Available It's available in an Insiders build or a release and removed Work-Item It's being tracked by an actual work item internally. (to be removed soon) Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. labels Feb 12, 2018
@bitcrazed bitcrazed added Work-Item It's being tracked by an actual work item internally. (to be removed soon) and removed Resolution-Fix-Available It's available in an Insiders build or a release labels May 3, 2018
@bitcrazed
Copy link
Contributor

bitcrazed commented May 3, 2018

Thanks for posting with repro @dra27 - can confirm this is still an issue post-RS4:

image

Also, if I drag the right hand edge, shrinking the Console, I get "underlines galore"!

image

Over to you @zadjii-msft ;)

Internal Bug# 17363227

@adiviness adiviness added the Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. label Jul 9, 2018
Stebalien pushed a commit to Stebalien/term that referenced this issue Aug 22, 2018
 * As cmr's comment says, COMMON_LVB_REVERSE_VIDEO and COMMON_LVB_UNDERSCORE
   are not usable. There is a mode flag (ENABLE_LVB_GRID_WORLDWIDE) that is
   supposed to make them work, but:
    1. COMMON_LVB_REVERSE_VIDEO works on Windows 10 regardless of whether
       this flag is set.
    2. I couldn't get COMMON_LVB_UNDERSCORE to work no matter what. Maybe
       it's this bug (microsoft/terminal#47).
       Maybe not, I don't know.
    3. Since setting ENABLE_LVB_GRID_WORLDWIDE fails on older Windows
       versions (tested on Windows 7), and since Windows 10 has the flag
       ENABLE_VIRTUAL_TERMINAL_PROCESSING which enables xterm-level
       ANSI compatibility. This whole exercise is pointless.

 * This commit adds simple emulations for three attributes:
    1. Reverse: simply reverse fg and bg.
    2. Secure: set fg = bg.
    3. Standout: set BACKGROUND_INTENSITY.

 This should improve the situation slightly on older versions of Windows.
 For Windows 10, we should take advantage of
 ENABLE_VIRTUAL_TERMINAL_PROCESSING. One approach of doing so will be
 shared in a following commit/PR.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
MoSal added a commit to rust-alt/term that referenced this issue Aug 22, 2018
 * As cmr's comment says, COMMON_LVB_REVERSE_VIDEO and COMMON_LVB_UNDERSCORE
   are not usable. There is a mode flag (ENABLE_LVB_GRID_WORLDWIDE) that is
   supposed to make them work, but:
    1. COMMON_LVB_REVERSE_VIDEO works on Windows 10 regardless of whether
       this flag is set.
    2. I couldn't get COMMON_LVB_UNDERSCORE to work no matter what. Maybe
       it's this bug (microsoft/terminal#47).
       Maybe not, I don't know.
    3. Since setting ENABLE_LVB_GRID_WORLDWIDE fails on older Windows
       versions (tested on Windows 7), and since Windows 10 has the flag
       ENABLE_VIRTUAL_TERMINAL_PROCESSING which enables xterm-level
       ANSI compatibility. This whole exercise is pointless.

 * This commit adds simple emulations for three attributes:
    1. Reverse: simply reverse fg and bg.
    2. Secure: set fg = bg.
    3. Standout: set BACKGROUND_INTENSITY.

 This should improve the situation slightly on older versions of Windows.
 For Windows 10, we should take advantage of
 ENABLE_VIRTUAL_TERMINAL_PROCESSING. One approach of doing so will be
 shared in a following commit/PR.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
@DHowett-MSFT DHowett-MSFT removed the Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. label Oct 25, 2018
@DHowett-MSFT
Copy link
Contributor

This is fixed in the "October 2018 Update".

@DHowett-MSFT DHowett-MSFT removed the Work-Item It's being tracked by an actual work item internally. (to be removed soon) label Oct 25, 2018
@zadjii-msft zadjii-msft added the Resolution-Fix-Available It's available in an Insiders build or a release label Oct 25, 2018
@zadjii-msft zadjii-msft added this to the RS5 milestone Oct 25, 2018
@scrouthtv
Copy link

@DHowett-MSFT COMMON_LVB_UNDERSCORE is not working for me. Should I open a new issue?

I am running 1.7.572.0

@zadjii-msft
Copy link
Member

@scrouthtv Probably - this bug is just about 3 years old (and entirely predates the Terminal's entire codebase), so if you're seeing something like this, it's probably a different root cause.

@DHowett
Copy link
Member

DHowett commented Mar 15, 2021

I believe we decoupled COMMON_LVB_UNDERSCORE from SGR 4 underline, and now Terminal therefore ignores COMMON_LVB_UNDERSCORE.

@scrouthtv
Copy link

I just found there's already an opened issue about this: #8037

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product-Conhost For issues in the Console codebase Resolution-Fix-Available It's available in an Insiders build or a release
Projects
None yet
Development

No branches or pull requests

7 participants