From 45db43aa95f837c680da8dbe08f8f8a27b5cc680 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 3 Apr 2023 08:43:03 -0700 Subject: [PATCH] fix permute_any_mods The termwiz Modifiers type isn't the right one! Use the input layer types instead, and then we get the correct string formatting. refs: https://github.com/wez/wezterm/issues/3434 --- Cargo.lock | 1 + lua-api-crates/termwiz-funcs/Cargo.toml | 1 + lua-api-crates/termwiz-funcs/src/lib.rs | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index f95ebdbaa..31763b18a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5166,6 +5166,7 @@ dependencies = [ "terminfo", "termwiz", "wezterm-dynamic", + "wezterm-input-types", ] [[package]] diff --git a/lua-api-crates/termwiz-funcs/Cargo.toml b/lua-api-crates/termwiz-funcs/Cargo.toml index e763709b6..33a6e048a 100644 --- a/lua-api-crates/termwiz-funcs/Cargo.toml +++ b/lua-api-crates/termwiz-funcs/Cargo.toml @@ -11,6 +11,7 @@ config = { path = "../../config" } finl_unicode = "1.2" terminfo = "0.8" wezterm-dynamic = { path = "../../wezterm-dynamic" } +wezterm-input-types = { path = "../../wezterm-input-types" } luahelper = { path = "../../luahelper" } termwiz = { path = "../../termwiz", features=["use_serde"] } lazy_static = "1.4" diff --git a/lua-api-crates/termwiz-funcs/src/lib.rs b/lua-api-crates/termwiz-funcs/src/lib.rs index 4f8704752..69bcbab8f 100644 --- a/lua-api-crates/termwiz-funcs/src/lib.rs +++ b/lua-api-crates/termwiz-funcs/src/lib.rs @@ -204,6 +204,8 @@ fn permute_mods<'lua>( item: mlua::Table, allow_none: bool, ) -> mlua::Result>> { + use wezterm_input_types::Modifiers; + let mut result = vec![]; for ctrl in &[Modifiers::NONE, Modifiers::CTRL] { for shift in &[Modifiers::NONE, Modifiers::SHIFT] { @@ -219,7 +221,7 @@ fn permute_mods<'lua>( let (k, v) = pair?; new_item.set(k, v)?; } - new_item.set("mods", format!("{:?}", flags))?; + new_item.set("mods", flags.to_string())?; result.push(new_item.to_lua(lua)?); } }