wezterm icon indicating copy to clipboard operation
wezterm copied to clipboard

set_config_overrides overrides active key_table

Open MLFlexer opened this issue 1 year ago • 1 comments

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

Linux Wayland

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

Gnome 45.4

WezTerm version

wezterm 20240405-180910-cce0706b

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

The key table is not activated if you activate the key table, and then change the config via. set_config_override

To Reproduce

The following keybind should reproduce the issue, as it is expected to enter copy mode, but it does not enter copy mode:

	{
		key = "m",
		mods = "ALT",
		action = wezterm.action.Multiple({
			wezterm.action.ActivateKeyTable({
				name = "copy_mode",
				one_shot = false,
			}),
			wezterm.action_callback(function(win, pane)
				local conf = win:get_config_overrides()
				if conf == nil then
					conf = { hide_tab_bar_if_only_one_tab = true }
				else
					conf.hide_tab_bar_if_only_one_tab = not conf.hide_tab_bar_if_only_one_tab
				end

				win:set_config_overrides(conf)
			end),

		}),
	}

Configuration

config.keys = {	{
		key = "m",
		mods = "ALT",
		action = wezterm.action.Multiple({
			wezterm.action.ActivateKeyTable({
				name = "copy_mode",
				one_shot = false,
			}),
			wezterm.action_callback(function(win, pane)
				local conf = win:get_config_overrides()
				if conf == nil then
					conf = { hide_tab_bar_if_only_one_tab = true }
				else
					conf.hide_tab_bar_if_only_one_tab = not conf.hide_tab_bar_if_only_one_tab
				end

				win:set_config_overrides(conf)
			end),
		}),
	}}

Expected Behavior

I would expect the key table to be activated when the set_config_override function does not change the key table of the config

Logs

No response

Anything else?

No response

MLFlexer avatar Apr 20 '24 09:04 MLFlexer

Hmm, this might be semi-intentional. There's some logic that clears the key table stack when the config is changed, as a way to facilitate "un-bricking" your setup if you screw up your config and end up in an impossible key table state.

wez avatar May 05 '24 23:05 wez