1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-30 06:03:39 +03:00
Commit Graph

17 Commits

Author SHA1 Message Date
Jalil David Salamé Messina
d541e2e13d fix(clippy): Remove closures where possible
- Removes closures and function calls for types that implement default:

  ```rust
  // Change
  let _my_str = get_str().unwrap_or(String::new);
  // To
  let _my_str = get_str().unwrap_or_default();
  ```

- Uses the `.cloned()/.copied()` methods where possible
- Use function pointer instead of simple closure

May improve performace, as closures generate more code, and this might
unlock some inlining opportunities.
2023-03-19 08:41:38 -07:00
Jalil David Salamé Messina
c6dc38b7f3 fix(clippy): Derive Default where possible 2023-03-15 10:21:11 -07:00
Wez Furlong
6f62a0f2b1
config: capture warnings and show them in config error window
This allows deprecated and invalid fields to be surfaced more visibly
in the config error window.
2023-01-24 14:18:15 -07:00
Wez Furlong
0516b61f62
lfucache: improve LFU algorithm and structure
Do it "more properly": use intrusive list linkage to manage three
indices:

* hash lookup
* recency
* frequency

eviction is frequency based, but in order to avoid things that were
super hot in the past and that are no longer hot clogging up the cache,
eviction will incrementally age out least recently used entries that
haven't been active in the span of some number of get/put operations.

Aging scales down the frequency value to reduce its strength, so an aged
item isn't necessarily immediately a candidate for removal, it just
makes it more likely to be picked up by the frequency based removal as
it goes unused for an extended period.
2022-11-14 10:00:49 -07:00
Wez Furlong
de466cfa64 config: validate consistency of domain names
refs: https://github.com/wez/wezterm/issues/2618
2022-10-11 06:59:12 -07:00
Wez Furlong
da13cf69fa docs for activate-pane-direction
* Enhance usage info in `wezterm cli activate-pane-direction --help` by
  showing the variants.
* Update shell completions
* docs and changelog entry
2022-09-20 08:50:46 -07:00
Davide Cavalca
0048209bcf Add missing license files 2022-08-17 07:19:12 -07:00
Wez Furlong
355b6d835b prep for publishing wezterm-bidi and wezterm-dynamic to crates.io 2022-08-01 18:35:56 -07:00
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