This is a bit fiddly because the serde library doesn't let us know
eg: which key in a map had an error, so we have to show the information
from the value and hope that there is enough context for the user.
This commit adds our own Debug impl for ValueWrapper as that one
provided by mlua isn't useful for tables; our impl will iterate
the pairs in the table and pretty print them.
The struct error message has been adjusted to include the lua
value that failed to deserialize in addition to the type name.
Because the config structs can get quite large, this commit adjusts
the ordering of the components in the error message; we now print
the outermost error first and leave the most specific portion at
the bottom. This is so that the error window is more likely to
show the most useful information at the bottom.
I've added some similar improvements when processing enums.
It's not perfect but hopefully more useful when figuring out
a config problem.
This invalid config:
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="{", mods="SHIFT|ALT", action="Search"},
}
}
```
yields:
```
While (re)loading configuration: Error converting lua value returned by script /tmp/issue-201.lua to Config struct: while processing a struct of type `Config` with value:
{
"keys": [
{
"mods": "SHIFT|ALT",
"key": "{",
"action": "Search",
},
],
}
while processing a struct of type `Key` with value:
{
"mods": "SHIFT|ALT",
"key": "{",
"action": "Search",
}
while processing an enum of type `KeyAssignment` and value "Search"
which has allowed variants `ActivateCopyMode`, `ActivateTab`, `ActivateTabRelative`, `ClearScrollback`, `CloseCurrentTab`, `CompleteSelection`, `CompleteSelectionOrOpenLinkAtMouseCursor`, `Copy`, `DecreaseFontSize`, `DisableDefaultAssignment`, `ExtendSelectionToMouseCursor`, `Hide`, `HideApplication`, `IncreaseFontSize`, `MoveTab`, `MoveTabRelative`, `Nop`, `OpenLinkAtMouseCursor`, `Paste`, `PastePrimarySelection`, `QuitApplication`, `ReloadConfiguration`, `ResetFontSize`, `ScrollByPage`, `Search`, `SelectTextAtMouseCursor`, `SendString`, `Show`, `ShowLauncher`, `ShowTabNavigator`, `SpawnCommandInNewTab`, `SpawnCommandInNewWindow`, `SpawnTab`, `SpawnWindow`, `ToggleFullScreen`
Expected a variant with parameters but got a unit variant instead
```
refs: https://github.com/wez/wezterm/issues/201
The captured variable used to track the last cursor time wasn't
working as intended; rather than reflecting the time of the last
blink update it was always reading as the time at which the window
was created which meant that we would choose to invalidate the
window on every candidate frame (every 35ms) rather than every
cursor blink interval, burning some CPU (~4-5% continuous on my system).
This was hard to spot because it looked like it was doing the right
thing. It didn't show up as a hotspot in the profiler either :-p
This commit moves that state into the TermWindow itself; I see CPU
utilization drop to ~0.7% which is much better.
refs: https://github.com/wez/wezterm/issues/200
When cycling through matches, set the current selection to the
matched range. This doesn't implicitly copy; it just marks the
range.
You can use the `Copy` key assignment to explicitly copy the
selection to the clipboard.
I'm sort of on the fence about implicit copying.
When the search overlay is active, pressing ctrl-r cycles through
the different pattern matching modes; currently case sensitive and
case insensitive, but shortly to add regex.
The search ui now also indicates the current mode.
The default opens up search with an empty pattern in case sensitive
string matching mode.
The revised structure will allow doing things like eg: defining a key
assignment that searches for git hashes by regex.
If set to true, then none of the default key or mouse bindings,
respectively, will be registered in the GUI, leaving it up to
the user to provide all key assignments.
The goal at the window layer is to preserve enough useful information
for other layers. In this specific circumstance on macos we'd like
to be able know both that eg: ALT-1 was pressed and that ALT-1 composes
to a different unmodified sequence and then allow the user's key
binding assignment to potentially match on both.
We sort of allowed for this, but didn't separate out the modifier keys.
This commit adds a `raw_modifiers` concept to the underlying event
struct so that we can carry both the raw key and modifier information
as well as the composed key and modifier information.
In the scenario above, we want the raw key/modifier tuple to be ALT-1
but the composed key/modifier to be eg: unmodified `¡` in my english
keymap.
refs: https://github.com/wez/wezterm/issues/158
This allows for: `wezterm start --cwd c:/` to spawn the default
program explicitly in the `c:/` location, rather than the default
behavior for determining the cwd.
refs: https://github.com/wez/wezterm/issues/155
Bound to CMD-K and CTRL+SHIFT-K by default. This also functions
while the output is filling up (eg: `find /` and hit the key binding
to keep pruning the scrollback).
closes: https://github.com/wez/wezterm/issues/194
The root cause of this was that the dirtyness test always considered
the display to be changed and was clearing the selection to ensure
visual consistency.
This was actually a stealthy bug where we'd use more CPU and memory
than we strictly needed.
closes: https://github.com/wez/wezterm/issues/189
The click/movement related events are now "table driven" with
defaults contained in the InputMap object.
This gives the the potential to be configured from the config
file, but there is not glue in the config layer to enable
this yet.
This also does not include mouse wheel events.
introduce a helper enum that represents a mouse event in a more
ergnomic form and break the processing into two stages.
This will enable moving the mouse actions into assignable
actions in a later commit.
Now that the toml file support is removed, we can directly
express the key actions as enum variants so remove this
intermediate type and use the enum directly.
I've been meaning to do this for a while: the intended purpose
is to use this to filter ansi escape sequences out of the prompt
in the shell pre-command hook.
This commit adds some plumbing that will use the github API to
probe the currently released version of wezterm, and if it is
newer than the running version, show a window with some release
information and links to the changelog and download page.
The checks can be disabled in the config (but require a restart
to take effect!) and default to checking every 24 hours.
If running an AppImage on linux, links directly to the appimage
download. In the future I'd like to have the download button
use zsync to apply the update to the local image.