mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 05:12:40 +03:00
wezterm.format: accept "ResetAttributes" to reset attributes
This commit is contained in:
parent
af5938d414
commit
8bad7dee58
@ -22,7 +22,9 @@ wezterm.log_info(wezterm.format({
|
|||||||
{Attribute={Underline="Single"}},
|
{Attribute={Underline="Single"}},
|
||||||
{Foreground={AnsiColor="Fuchsia"}},
|
{Foreground={AnsiColor="Fuchsia"}},
|
||||||
{Background={Color="blue"}},
|
{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`.
|
* `{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={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.
|
* `{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*)
|
||||||
|
@ -98,6 +98,7 @@ pub enum FormatItem {
|
|||||||
Foreground(FormatColor),
|
Foreground(FormatColor),
|
||||||
Background(FormatColor),
|
Background(FormatColor),
|
||||||
Attribute(AttributeChange),
|
Attribute(AttributeChange),
|
||||||
|
ResetAttributes,
|
||||||
Text(String),
|
Text(String),
|
||||||
}
|
}
|
||||||
impl_lua_conversion_dynamic!(FormatItem);
|
impl_lua_conversion_dynamic!(FormatItem);
|
||||||
@ -109,6 +110,7 @@ impl Into<Change> for FormatItem {
|
|||||||
Self::Text(t) => t.into(),
|
Self::Text(t) => t.into(),
|
||||||
Self::Foreground(c) => AttributeChange::Foreground(c.to_attr()).into(),
|
Self::Foreground(c) => AttributeChange::Foreground(c.to_attr()).into(),
|
||||||
Self::Background(c) => AttributeChange::Background(c.to_attr()).into(),
|
Self::Background(c) => AttributeChange::Background(c.to_attr()).into(),
|
||||||
|
Self::ResetAttributes => Change::AllAttributes(CellAttributes::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user