zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.89k stars 2.69k forks source link

Terminal rendering issues with block graphics #15927

Open willmcgugan opened 1 month ago

willmcgugan commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

The builtin terminal displays some rendering glitches when used with TUIs.

Block graphics don't line up with neighboring cells. Tested with a Textual app.

You should be able to see it by installing Textual and running the following command:

textual borders

Environment

Zed: v0.146.3 (Zed) OS: macOS 14.5.0 Memory: 16 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

This is Zed:

https://github.com/user-attachments/assets/5dfbc0a6-b8f2-4b7a-8d5e-92d25ceb67b1

This is iTerm2 (similar on most other terminals)

https://github.com/user-attachments/assets/f6eccb09-8e2d-47e4-9c38-709cf78bc6f1

If applicable, attach your Zed.log file to this issue.

Zed.log


willmcgugan commented 1 month ago

Tweaking the line height in settings improves things a little, but some artifacts remain.

The artifacts look similar to an older version of xterm.js. If that's what you are using, the latest version should fix most of these issues.

rgbkrk commented 1 month ago

We're using Alacritty with custom rendering using GPUI.

willmcgugan commented 1 month ago

We're using Alacritty with custom rendering using GPUI.

That's encouraging. Alacritty does a good job of rendering TUIs, so this is hopefully a configuration issue.

SomeoneToIgnore commented 1 month ago

Looks like a duplicate of

rgbkrk commented 1 month ago

Looks like a duplicate of #15542

Sure enough, if I switch to IBM Plex Mono with line height "standard" in my settings, it renders almost perfectly:

image

Try this in your settings @willmcgugan, just to confirm as we are in transition to using IBM Plex by default IIRC.

  "terminal": {
    "font_family": "IBM Plex Mono",
    "line_height": "standard"
  }
rgbkrk commented 1 month ago

REPL outputs will also have to use IBM Plex Mono and buffer_line_height set to "standard" as well to get good rectangles:

image

willmcgugan commented 1 month ago

A definite improvement, but there are still glitches.

Screenshot 2024-08-12 at 20 55 54

Note how the lines between the buttons extend over the scrollbar, and the thin cracks at the bottom of the scrollbar.

These issues are common when the terminal uses glyphs to render box character. Most terminals will render box characters separately to avoid these artifacts.

I think Alacrity does have this capability. Here's a screenshot from Alacrity:

Screenshot 2024-08-12 at 21 00 10

I know its subtle -- I've been staring at these things for 3 years!