diff --git a/docs/config/lua/wezterm/format.md b/docs/config/lua/wezterm/format.md index 3a581f5fe..96b786a4e 100644 --- a/docs/config/lua/wezterm/format.md +++ b/docs/config/lua/wezterm/format.md @@ -22,7 +22,9 @@ wezterm.log_info(wezterm.format({ {Attribute={Underline="Single"}}, {Foreground={AnsiColor="Fuchsia"}}, {Background={Color="blue"}}, - {Text="Hello " .. date}, + {Text="Hello " .. date .. " "}, + "ResetAttributes", + {Text="this text has default attributes"} })) ``` @@ -44,4 +46,4 @@ Possible values for the `FormatItem` elements are: * `{Foreground={Color="yellow"}}` - set foreground color to a named color or rgb value like `#ffffff`. * `{Background={AnsiColor="Black"}}` - set the background color to an ansi color as per `Foreground` above. * `{Background={Color="blue"}}` - set the background color to a named color or rgb value as per `Foreground` above. - +* `"ResetAttributes"` - reset all attributes to default. (*Since: nightly builds only*) diff --git a/lua-api-crates/termwiz-funcs/src/lib.rs b/lua-api-crates/termwiz-funcs/src/lib.rs index 4505c1690..37a371d3f 100644 --- a/lua-api-crates/termwiz-funcs/src/lib.rs +++ b/lua-api-crates/termwiz-funcs/src/lib.rs @@ -98,6 +98,7 @@ pub enum FormatItem { Foreground(FormatColor), Background(FormatColor), Attribute(AttributeChange), + ResetAttributes, Text(String), } impl_lua_conversion_dynamic!(FormatItem); @@ -109,6 +110,7 @@ impl Into for FormatItem { Self::Text(t) => t.into(), Self::Foreground(c) => AttributeChange::Foreground(c.to_attr()).into(), Self::Background(c) => AttributeChange::Background(c.to_attr()).into(), + Self::ResetAttributes => Change::AllAttributes(CellAttributes::default()), } } }