Skip to content

Prompt is printed with SGR 40, resulting in black bands on supporting terminals #2516

@DHowett

Description

@DHowett

Purpose of the issue

  • Bug report (encountered problems/errors)
  • Feature request (request for new functionality)
  • Question

Version Information

This was migrated from microsoft/terminal#9693, and it appears to be valid with the latest code on master.
The user is using cmder's shell configuration outside of ConEmu, so I understand if this is not a valid report.

Description of the issue

When updating the prompt here ...

local cmder_prompt = "\x1b[1;32;40m{cwd} {git}{hg}{svn} \n\x1b[1;39;40m{lamb} \x1b[0m"

... clink specifically requests graphical rendition 40, "ANSI Color 0 Background". This works fairly well for the traditional Windows console and ConEmu, but it is not entirely correct. There is no guarantee that the user's background color is ANSI color 0! In certain terminals (Windows Terminal, gnome-terminal, ...) the user can specify a background color that cannot be represented via SGR, such as that of an image or a transparency effect.

The result is that when the user has transparency enabled, their terminal looks somewhat like this:

image

The ideal solution would be to print using SGR 49, "revert to default background". This has been supported on all versions of Windows where ENABLE_VIRTUAL_TERMINAL_PROCESSING supports colors, so there is no compatibility risk.

We had to fix a similar issue here in PowerShell: PowerShell/PSReadLine#1626

In short, the Windows console is getting better at determining when the user wanted a specific background color and when they wanted the default. I need to do an actual write-up about what's changed rather than writing a bunch of different GitHub comments, so that I can point users and developers at it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions