wezterm icon indicating copy to clipboard operation
wezterm copied to clipboard

Colors not picked up by escape codes when colors are set from event

Open chtenb opened this issue 1 year ago • 2 comments

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

Windows

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

No response

WezTerm version

wezterm 20240325-093507-e5ac32f2

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

When I set my colors through the window-config-reloaded (to dynamically set it to light or dark), they are not picked up when I use ansi escape codes when setting the status bar.

To Reproduce

No response

Configuration

local wezterm = require 'wezterm';

wezterm.on('window-config-reloaded', function(window, pane)
  local overrides = window:get_config_overrides() or {}
  overrides.colors = {
    indexed = {
      [232] = 'red',
    }
  }
  window:set_config_overrides(overrides)
end)

wezterm.on("update-status", function(window, pane)
  local bg = '232'
  window:set_right_status(wezterm.format({{ Text = '\x1b[48:5:' .. bg .. ':0m' }, { Text = 'Hello'}}))
end)


Config = {}
Config.use_fancy_tab_bar = false
Config.tab_bar_at_bottom = true
-- When this is uncommented, it works
-- Config.colors = {
--   indexed = {
--     [232] = 'red',
--   }
-- }
return Config

Expected Behavior

image

Instead, this happened:

image

Logs

No log events written

Anything else?

I will try to install the nightly version of wezterm later today to see if it is still a problem there

chtenb avatar May 27 '24 07:05 chtenb

As promised, I installed the latest nightly build, and this issue is still present.

chtenb avatar May 30 '24 13:05 chtenb

I wanted to troubleshoot this issue a little bit today, and I noticed that I had made a mistake in the minimal repro config I provided: I forgot to include the call to window:set_config_overrides(overrides). I've updated the config in the original post. The issue still reproduces.

To be clear, I can confirm that setting the ansi color overrides like above works correctly for terminal apps. Just not for the handlers that handle the tab titles and the status bar for some reason.

chtenb avatar Aug 05 '24 16:08 chtenb