wez / wezterm

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

weird % symbol on startup #5387

Closed k2662 closed 2 weeks ago

k2662 commented 2 months ago

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

macOS

Screenshot of issue:

image

WezTerm version

20240203-110809-5046fc22 and 20240506-145255-0b50725f

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

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

a % symbol always shows at startup

To Reproduce

set zsh PS1 to PS1='%F{green}%1~>%f '

Configuration

local wezterm = require("wezterm")

local colors = require('themes/lua/rose-pine-moon').colors()

local window_frame = require('themes/lua/rose-pine-moon').window_frame()

return {
    -- OpenGL for GPU acceleration, Software for CPU, or WebGpu
    front_end = "WebGpu",

  term = "xterm-256color",

    colors = colors,

    -- Font config
    font = wezterm.font("JetBrainsMono Nerd Font", { weight="Medium", stretch="Normal", style="Normal" }),
    font_rules = {
        {
            italic = true,
            font = wezterm.font("JetBrainsMono Nerd Font", { weight="Medium", stretch="Normal", italic = true }),
        },
        {
            italic = false,
            font = wezterm.font("JetBrainsMono Nerd Font", { weight="Medium", stretch="Normal", bold = true }),
        },
        {
            intensity = "Bold",
            font = wezterm.font("JetBrainsMono Nerd Font", { weight="Bold", stretch="Normal", bold = true }),
        },
    },

    warn_about_missing_glyphs = false,
    font_size = 16,
    line_height = 1.0,

    -- Cursor style
    default_cursor_style = "BlinkingBar",

    bold_brightens_ansi_colors = true,
    -- Padding
    window_padding = {
        left = 6,
        right = 6,
        top = 6,
        bottom = 6,
    },

    -- Tab Bar
    enable_tab_bar = true,
    hide_tab_bar_if_only_one_tab = true,
    show_tab_index_in_tab_bar = false,
    tab_bar_at_bottom = true,

    -- General
    window_decorations = "RESIZE | MACOS_FORCE_DISABLE_SHADOW",
  macos_window_background_blur = 18,
    automatically_reload_config = true,
    window_background_opacity = 0.5,
    window_close_confirmation = "NeverPrompt",
    audible_bell = "Disabled",
  window_frame = window_frame,
}

My Theme

-- rose-pine-moon
-- Copyright (c) 2022 rose-pine

-- repository: https://github.com/neapsix/wezterm
-- license: MIT

local M = {}

local palette = {
    base = '#232136',
    overlay = '#393552',
    muted = '#6e6a86',
    text = '#e0def4',
    love = '#eb6f92',
    gold = '#f6c177',
    -- rose = '#ea9a97',
    pine = '#3e8fb0',
    foam = '#9ccfd8',
    iris = '#c4a7e7',
    -- highlight_high = '#56526e',
}

local active_tab = {
    bg_color = palette.overlay,
    fg_color = palette.text,
}

local inactive_tab = {
    bg_color = palette.base,
    fg_color = palette.muted,
}

function M.colors()
    return {
        foreground = palette.text,
        background = palette.base,
        cursor_bg = palette.text,
        cursor_border = '#59546d',
        cursor_fg = palette.text,
        selection_bg = palette.iris,
        selection_fg = palette.text,

        ansi = {
            palette.overlay,
            palette.love,
            palette.pine,
            palette.gold,
            palette.foam,
            palette.iris,
            '#ebbcba', -- replacement for palette.rose,
            palette.text,
        },

        brights = {
            '#817c9c', -- replacement for palette.muted,
            palette.love,
            palette.pine,
            palette.gold,
            palette.foam,
            palette.iris,
            '#ebbcba', -- replacement for palette.rose,
            palette.text,
        },

        tab_bar = {
            background = palette.base,
            active_tab = active_tab,
            inactive_tab = inactive_tab,
            inactive_tab_hover = active_tab,
            new_tab = inactive_tab,
            new_tab_hover = active_tab,
            inactive_tab_edge = palette.muted, -- (Fancy tab bar only)
        },
    }
end

function M.window_frame() -- (Fancy tab bar only)
    return {
        active_titlebar_bg = palette.base,
        inactive_titlebar_bg = palette.base,
    }
end

return M

Expected Behavior

There shouldn't be random % symbol at startup. kitty terminal doesn't have this issue

Logs

10:05:29.412 INFO wezterm_gui::termwindow > QuitApplication over here (window)

Anything else?

No response

bew commented 2 months ago

Hello, I'd suggest you to try to disable the code that shows you the os/host/kernel/uptime/.. and see if you still have this issue 🤔

k2662 commented 2 months ago

Hello, I'd suggest you to try to disable the code that shows you the os/host/kernel/uptime/.. and see if you still have this issue 🤔

I already tried that.

bew commented 2 months ago

Does that still reproduce without any config for wezterm? (using wezterm --skip-config)

If so, please make a recording of the exact output made to the terminal using wezterm record, and upload the result here for analysis 🙏

k2662 commented 2 months ago

yes it still has the % symbol, I cannot seem to get it to record, as it only happens when it takes up the entire screen but not when it is split like this: image

it is macos so it uses the .app extension and does not use .desktop files like *bsd or linux. Due to this, it is difficult to use wezterm record.

but here: {"version":2,"width":187,"height":47,"timestamp":1715105109,"command":"'/Applications/WezTerm.app/Contents/MacOS/wezterm --skip-config'","env":{"WEZTERM_TARGET_TRIPLE":"x86_64-apple-darwin", "LANG":"en_US.UTF-8","WEZTERM_VERSION":"20240506-145255-0b50725f"}}

ninjalj commented 2 months ago

That's zsh marking a partial line (a line that does not end in a newline before a prompt). See PROMPT_EOL_MARK on the zsh manual.

Maybe something is getting a wrong idea of wezterm's width in columns, attempting to move to the next line via outputting spaces, and failing?

wez commented 2 months ago

My hunch is that the window is being resized/maximized by something outside of wezterm (some local window manager extension?) very early during startup and that is racing with the window size being calculated/observed by your fetch program and zsh.

k2662 commented 2 months ago

My hunch is that the window is being resized/maximized by something outside of wezterm (some local window manager extension?) very early during startup and that is racing with the window size being calculated/observed by your fetch program and zsh.

makes sense. I use https://github.com/koekeishiya/yabai as my wm.

wez commented 2 months ago

I don't have any great suggestions for this; this class of early startup resize issue is a bit thorny to reconcile because, in wezterm, the ptys are started in the context of the multiplexer layer, which may not have a GUI, and the GUI is then notified of the pty and adjusts to render it. Synchronizing the startup/size with that is technically possible with some effort, but it would come at the cost of introducing some additional delay during startup which many users will not tolerate.

In the meantime, if it really bothers you, then you could try:

wez commented 2 months ago

or you can tell zsh not to show this mark: https://superuser.com/questions/645599/why-is-a-percent-sign-appearing-before-each-prompt-on-zsh-in-windows