wez / wezterm

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

Terminal flashing non-stop #4246

Open DrGo opened 1 year ago

DrGo commented 1 year ago

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

macOS

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

none

WezTerm version

wezterm 20230712-072601-f4abf8fd

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

Screen flashing all time at a fast rate even when no keys are pressed. Pls see cast:

wezterm-recording-zNnhV7.cast.txt

It does not happen in macOS Terminal

To Reproduce

No response

Configuration

local wezterm = require 'wezterm'

function Scheme_for_appearance(appearance)
    -- print(appearance)
    if appearance:find 'Dark' then
        return 'iceberg-dark'
    else
        return 'Tango Half Adapted'
    end
end
local config = wezterm.config_builder()

config.color_scheme = Scheme_for_appearance(wezterm.gui.get_appearance())
config.font = wezterm.font 'Fira Code'
config.font_size = 16.0
config.hide_tab_bar_if_only_one_tab = true
config.window_padding = {
    left = 0,
    right = 0,
    top = 0,
    bottom = 0,
}
config.initial_rows = 90
config.initial_cols = 120
config.window_close_confirmation = 'NeverPrompt'

---cycle through builtin dark schemes in dark mode, 
---and through light schemes in light mode
local function themeCycler(window, _)
    -- print('inside recycler')
    local allSchemes = wezterm.color.get_builtin_schemes()
    local currentMode = wezterm.gui.get_appearance()
    local currentScheme = window:effective_config().color_scheme
    local darkSchemes = {}
    local lightSchemes = {}

    for name, scheme in pairs(allSchemes) do
        local bg = wezterm.color.parse(scheme.background) -- parse into a color object
        ---@diagnostic disable-next-line: unused-local
        local h, s, l, a = bg:hsla() -- and extract HSLA information
        if l < 0.4 then
            table.insert(darkSchemes, name)
        else
            table.insert(lightSchemes, name)
    end
end
    local schemesToSearch = currentMode:find("Dark") and darkSchemes or lightSchemes

    for i = 1, #schemesToSearch, 1 do
        if schemesToSearch[i] == currentScheme then
            local overrides = window:get_config_overrides() or {}
            overrides.color_scheme = schemesToSearch[i+1]
            wezterm.log_info("Switched to: " .. schemesToSearch[i+1])
            window:set_config_overrides(overrides)
            return
        end
    end
end
config.keys = {
    -- Theme Cycler
    { key = "t", mods = "CTRL", action = wezterm.action_callback(themeCycler) },

-- Look up Scheme you switched to
    { key = "Escape", mods = "CTRL", action = wezterm.action.ShowDebugOverlay }, }
return config

Expected Behavior

No response

Logs

No response

Anything else?

No response

DrGo commented 1 year ago

Note: only happens when wezterm window is active (has the focus)

wez commented 1 year ago

Note that wezterm record only records escape sequences from inside a terminal session. Replaying that recording here doesn't reproduce any flashing. You didn't include any logs in your report. Please check to see if something is being shown there. Please also share those logs: they help me understand the machine configuration better.

Are there certain actions that you are taking that trigger this behavior? Does it reproduce when you run wezterm -n with no configuration?

DrGo commented 1 year ago

Sorry for the delayed response... it did not happen again until today.. seems to be associated with starting Neovim although it continues after quitting Neovim and even after restarting wezterm. It only happens when wezterm has the focus as you see in the movie. Thanks again for all the good work you do on this app.

https://github.com/wez/wezterm/assets/12840815/dfb0eea7-4905-4449-9c88-717795ada274 wezterm-gui-log-494.txt wezterm-gui-log-57037.txt wezterm-gui-log-6203.txt wezterm-log-43972.txt wezterm-gui-log-6034.txt