1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 13:21:38 +03:00
Commit Graph

9 Commits

Author SHA1 Message Date
Wez Furlong
a1cb7a2a88 dynamic: add validate attribute, validate line_height.
It's now possible to specify a validation function for config
items.

Use that to validate line_height:

```
; ./target/debug/wezterm --config line_height=-1
08:41:10.576  ERROR  wezterm > Error converting lua value from overrides to Config struct: Error processing Config::line_height: Illegal value -1 for line_height; it must be positive and greater than zero!; terminating
```

refs: https://github.com/wez/wezterm/issues/2247
2022-07-12 08:41:42 -07:00
Wez Furlong
10b558fae2 dynamic: handle ambiguous {} object vs. array case centrally 2022-07-07 15:42:14 -07:00
Wez Furlong
f2627bc39e ActivateKeyTable replace_current wasn't actually optional
The issue here was that the from_dynamic impl derived for a struct
that was inlined in an enum didn't respect the the field properties
defined for the struct.

Refactor to reuse the same field_info helper used by the struct
code.

Update docs to clarify what the default value actually is.

refs: https://github.com/wez/wezterm/issues/2179
2022-06-25 19:38:39 -07:00
Wez Furlong
da7da888cd config: generate errors for things like --config tarm=foo
Invalid option names, or values that evaluate as nil (such as the `foo`
above: that's treated as a global variable reference, but `foo` isn't a
defined global and evaluates as `nil`) will now cause the program
startup to error out with an actionable error message.

Previously, the invalid config name would generate a warning, and the
invalid value would silently have no effect as it has the same effect as
omitting the named value and leaving it as its default value.

I think these cases should both immediately error out and stop
further processing, so that's what we're doing.

This commit also adds support for adding:

```
   #[dynamic(deprecated = "use newer option instead")]
   pub some_config_value: bool,
```

but not options currently use this.
2022-05-21 13:10:30 -07:00
Wez Furlong
94039c473b dynamic: allow defaulting to None for enum struct fields
refs: https://github.com/wez/wezterm/issues/1993#issuecomment-1133283042

```
DISPLAY=:0 ./target/debug/wezterm -n --config 'keys={{key="a", mods="NONE", action=wezterm.action{SwitchToWorkspace={ name = "default"}}}}'
```
2022-05-20 13:38:24 -07:00
Wez Furlong
d6063e180a config: fix specifying numeric font weights
add helpers to Value coerce to different numeric types, and use
one of those in the FontWeight conversion.

refs: #2012
2022-05-20 06:33:12 -07:00
Wez Furlong
42a7c1d481 dynamic: improve error messaging 2022-05-18 13:39:51 -07:00
Wez Furlong
c7387490a6 dynamic: add some doc comments 2022-05-18 09:54:02 -07:00
Wez Furlong
24c6830345 add wezterm-dynamic crate 2022-05-18 07:47:39 -07:00