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

Use of box-shadow for underline cusor can have aliasing issues under certain conditions #4580

Closed
dlech opened this issue Jul 1, 2023 · 0 comments · Fixed by #4584
Closed
Labels
type/proposal A proposal that needs some discussion before proceeding

Comments

@dlech
Copy link
Contributor

dlech commented Jul 1, 2023

The use of box-shadow to create the underline cursor can sometimes not render correctly. Here is a screenshot.

image

Details

  • Browser and browser version: Chromium Version 114.0.5735.106 (Official Build) snap (64-bit)
  • OS version: Ubuntu 22.04
  • xterm.js version: 5.2.1

Steps to reproduce

Unfortunately, I haven't been able to create a minimal reproducible test case. This started when we updated from blueprintjs 4.x to 5.x but I haven't been able to track down exactly what changed that triggered the issue. For the time being, the bug can be seen at https://beta.pybricks.com. Just click in the terminal area to focus it.

Suggested solution

From what I've read about box-shadow, aliasing issues like this happen sometimes. It seems like we could make a more robust cursor using border instead of box-shadow. This is the workaround I have come up with for now:

.xterm-dom-renderer-owner-1 .xterm-rows .xterm-cursor.xterm-cursor-underline {
    animation: pb-terminal-cursor 1s step-end infinite !important;
    box-shadow: none !important;
    border-top: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 1px;
    border-style: solid;
    border-color: black;

    .#{bp.$ns}-dark & {
        border-color: white;
    }
}

@keyframes pb-terminal-cursor {
    50% {
        border-style: hidden;
    }
}
dlech added a commit to pybricks/pybricks-code that referenced this issue Jul 5, 2023
Since updating to Blueprintjs 5.x we can get aliasing artifacts on the
cursor due to bad rendering of box-shadow. This overrides it with
border instead.

xtermjs/xterm.js#4580
dlech added a commit to pybricks/pybricks-code that referenced this issue Jul 5, 2023
Since updating to Blueprintjs 5.x we can get aliasing artifacts on the
cursor due to bad rendering of box-shadow. This overrides it with
border instead.

xtermjs/xterm.js#4580
dlech added a commit to dlech/xterm.js that referenced this issue Jul 5, 2023
In rare cases, box-shadow can cause aliasing artifacts on the top and
sides of the cursor box when only the bottom should be filled in to
create an underline.

This replaces the box-shadow style with border-bottom which should be
pixel perfect in all cases.

Fixes: xtermjs#4580
dlech added a commit to dlech/xterm.js that referenced this issue Jul 5, 2023
In rare cases, box-shadow can cause aliasing artifacts on the top and
sides of the cursor box when only the bottom should be filled in to
create an underline.

This replaces the box-shadow style with border-bottom which should be
pixel perfect in all cases.

Fixes: xtermjs#4580
@Tyriar Tyriar added the type/proposal A proposal that needs some discussion before proceeding label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal A proposal that needs some discussion before proceeding
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants