wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.17k stars 775 forks source link

MacOS: Weird font/unicode artifacts after update #4882

Closed cartesius68 closed 8 months ago

cartesius68 commented 8 months ago

What Operating System(s) are you seeing this problem on?

macOS

Which Wayland compositor or X11 Window manager(s) are you using?

No response

WezTerm version

20240127-113634-bbcac864

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

No, and I'll explain why below

Describe the bug

After an update to wezterm 20240127-113634-bbcac864 I cannot use wezterm anymore. Weird flickering artifacts for Ubuntu Mono or JetBrains Mono NL font. For example, I run vim, quit and some characters in the previous terminal state flicker for a second.

Crossed squares randomly appear for a split second... even when window not focused.

Even overall font rendering seems a bit changed.

Until resolved switching tu Kitty, sigh.....

MacOS Sonoma 14.3 (everything up to date), M2 Mac Mini

To Reproduce

  1. Run terminal
  2. Start vim
  3. Close vim
  4. See how some chars flicker

Configuration

-- Pull in the wezterm API
local wezterm = require("wezterm")

-- This table will hold the curation.
local c = {}

-- In newer versions of wezterm, use the c_builder which will
-- help provide clearer error messages
if wezterm.c_builder then
        c = wezterm.c_builder()
end

-- This is where you actually apply your c choices
c.default_prog = { "/opt/homebrew/bin/fish", "-l" }

--c.color_scheme = "Bamboo"
c.color_scheme = 'Cobalt 2 (Gogh)'

--c.font = wezterm.font("UbuntuMono Nerd Font Mono")

c.font = wezterm.font('JetBrains Mono NL')
--c.font = wezterm.font('Monaco')
--c.font = wezterm.font("Cascadia Code", {weight="DemiLight", stretch="Normal", italic=false})
--c.font = wezterm.font("Cascadia Code", {weight="Regular", stretch="Normal", italic=false})
--c.font = wezterm.font("Cascadia Code", {weight="DemiLight", stretch="Normal", italic=false})
c.font_size = 19
c.line_height = 1.08

c.initial_rows = 40
c.initial_cols = 140

c.harfbuzz_features = { "calt=0", "clig=0", "liga=0" }

c.keys = {
        {
                key = "a",
                mods = "CTRL|SHIFT",
                action = wezterm.action.ToggleFullScreen,
        },
}

-- and finally, return the curation to wezterm
return c

Expected Behavior

No response

Logs

No response

Anything else?

No response

wez commented 8 months ago

Try setting front_end = "OpenGL"

cartesius68 commented 8 months ago

Hi Sir,

Unfortunately, it's unrelated. No matter whatever front_end is used. But was lucky to capture a screen recording:

wezterm-bug.webm

wez commented 8 months ago

can you confirm that the front end setting was picked up? You have to restart wezterm for it to take effect

wez commented 8 months ago

You can see which is used by opening the debug overlay: CTRL-SHIFT-L and it will show information about your graphics setup, please share that here

cartesius68 commented 8 months ago

Same behavior even with front_end = 'Software'. Can reproduce that each time. Feels deterministic to me.

For the front_end = 'OpenGL' I get:

Debug Overlay
wezterm version: 20240127-113634-bbcac864 aarch64-apple-darwin
Window Environment: macOS 14.3 (23D56)
OpenGL: Apple M2 Pro 4.1 Metal - 88
Enter lua statements or expressions and hit Enter.
Press ESC or CTRL-D to exit
wez commented 8 months ago

Ah, looking closely, that flash is the deferred/asynchronous loading of the glyphs when the glyphs are not covered by the fonts listed in your config. You can resolve this by adding the relevant fonts to https://wezfurlong.org/wezterm/config/lua/wezterm/font_with_fallback.html and using that instead of wezterm.font.

Why is this more obvious in this release? Part of resolving #4099 #849 means that the fallback font resolution is now slightly more expensive so your chances of observing the intermediate placeholder glyph are higher than in previous versions.

Why is it ok before running vim, and not after? Since you are editing your wezterm lua file there, saving it causes a reload and flushing of the various cached information about your font(s), so it has to be resolved again.

What I suggest is this:

cartesius68 commented 8 months ago

Closing the issue. Behavior explained. Great work anyway!

github-actions[bot] commented 7 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.