1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-26 06:42:12 +03:00
Commit Graph

1254 Commits

Author SHA1 Message Date
Wez Furlong
e2c87c4b93 wezterm: search: ensure we perform the search when creating overlay
When pre-configured with a pattern, we need to execute it!
2020-05-29 09:32:51 -07:00
Wez Furlong
584ced1944 wezterm: search add regex as an pattern option 2020-05-29 09:24:30 -07:00
Wez Furlong
8b92fbdde3 wezterm: search ctrl-r cycles pattern matching mode
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.
2020-05-29 09:14:05 -07:00
Wez Furlong
7f83d2172c wezterm: add case insensitive search option 2020-05-29 09:06:04 -07:00
Wez Furlong
6b939c9048 wezterm: search: allow specifying pattern in key assignment
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.
2020-05-29 08:41:06 -07:00
Wez Furlong
44c3ee0e83 wezterm: search: fix cursor position to use grapheme width 2020-05-29 08:27:05 -07:00
Wez Furlong
633a4baad1 wezterm: fixup search result coords to be cell based indices 2020-05-29 08:24:04 -07:00
Wez Furlong
ed7b33d134 wezterm: fix pasting when an overlay is active
We would always send to the underlying terminal, which was wrong!
2020-05-29 08:18:36 -07:00
Wez Furlong
9f02e88de1 wezterm: simplify search API 2020-05-29 07:49:09 -07:00
Wez Furlong
9e89a557d4 wezterm: add disable_default_(key|mouse)_bindings config
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.
2020-05-28 22:22:02 -07:00
Wez Furlong
acd016cdd4 wezterm: send_composed_key_when_alt_is_pressed now defaults true
This should make our behavior more consistent with other terminal
emulators on macOS.

closes https://github.com/wez/wezterm/issues/158
2020-05-28 19:54:13 -07:00
Wez Furlong
9ff9bf15fd window: allow for stronger separation between raw and composed keys
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
2020-05-28 19:35:50 -07:00
Wez Furlong
264ba0d8b6 wezterm: add --cwd option to the start subcommand
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
2020-05-28 08:08:31 -07:00
Wez Furlong
2f6d72899f wezterm: search: ctrl-n, ctrl-p to move through search results
refs: https://github.com/wez/wezterm/issues/91
2020-05-28 06:55:27 -07:00
Wez Furlong
5c0f568f84 wezterm: search: handle resizing better 2020-05-27 20:44:15 -07:00
Wez Furlong
c1c6ef6ddb Add scrollback search function
For the moment this is basic case sensitive substring matching,
but it is extensible to case insentive and regex matching.

refs: https://github.com/wez/wezterm/issues/91
refs: https://github.com/wez/wezterm/issues/106
2020-05-27 18:19:22 -07:00
Wez Furlong
81ededa9ac define basic search interface 2020-05-26 06:25:08 -07:00
Wez Furlong
b8acbac113 wezterm: add ClearScrollback key assignment
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
2020-05-25 17:29:22 -07:00
Wez Furlong
3d1b52267e wezterm: teach updater about setup.exe 2020-05-25 12:55:59 -07:00
Wez Furlong
b8738c769d docs: ratelimit_output_bytes_per_second default value was incorrect 2020-05-24 07:29:14 -07:00
Wez Furlong
e65c138231 wezterm: fix copy and paste from tab overlays
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
2020-05-23 11:18:32 -07:00
Wez Furlong
6d007712bd wezterm: enable mouse binding assignments
This commit caps hooks up the mouse event plumbing to the config
system and enables mouse button event bindings.

closes: https://github.com/wez/wezterm/issues/119
2020-05-22 08:05:59 -07:00
Wez Furlong
b67682ddc9 wezterm: move most click related mouse events to InputMap
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.
2020-05-21 18:51:20 -07:00
Wez Furlong
b18e66968d wezterm: refactor mouse event processing
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.
2020-05-21 08:46:56 -07:00
Wez Furlong
db13b4dfe9 wezterm: add KeyAssignment::OpenLinkAtMouseCursor 2020-05-21 08:46:56 -07:00
Wez Furlong
24474fdf98 wezterm: add KeyAssignment::{SelectTextAtMouseCursor, ExtendSelectionToMouseCursor}
Add plumbing to trigger these actions; the default assignments for
the mouse are still currently hard coded.

refs: https://github.com/wez/wezterm/issues/119
2020-05-21 08:46:56 -07:00
Wez Furlong
57d270cae0 wezterm: add PastePrimarySelection key assignment
refs: https://github.com/wez/wezterm/issues/183
2020-05-21 08:46:56 -07:00
Wez Furlong
f6743086ac wezterm: remove KeyAction toml translation helper
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.
2020-05-21 08:46:40 -07:00
Wez Furlong
448fa084a9 wezterm: remove old TOML config file loading 2020-05-21 08:46:40 -07:00
Wez Furlong
a9d1429888 window: allow specifying the clipboard context when getting clipboard
refs: https://github.com/wez/wezterm/issues/183
2020-05-21 08:46:16 -07:00
Wez Furlong
845d990304 add strip-ansi-escape utility to wezterm package
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.
2020-05-17 21:51:07 -07:00
Wez Furlong
eaafce59ce wezterm: link to correct section of changelog in the update ui 2020-05-17 14:18:28 -07:00
Wez Furlong
4522ebfb40 fontconfig: reduce trace logging verbosity 2020-05-16 10:30:01 -07:00
Wez Furlong
d39c16c406 wezterm: check for new releases
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.
2020-05-08 22:18:31 -07:00
Wez Furlong
407e4f855c fix build on windows 2020-05-06 20:53:51 -07:00
Wez Furlong
c53ab60940 wezterm: support portable AppImage invocation
https://github.com/AppImage/AppImageKit/issues/368 introduced a way
to maintain configuration alongside an AppImage file stored on a
flash drive:

```
wez@cube-localdomain  /tmp/portable-wezterm
9:06 130 $ ls -al
total 8720
drwxrwxr-x.  4 wez  wez      100 May  6 08:54 ./
drwxrwxrwt. 19 root root     580 May  6 09:05 ../
-rwxr-xr-x.  1 wez  wez  8929256 May  6 08:59 WezTerm-20200505-090057-31c6155f-Fedora31.AppImage*
drwxrwxr-x.  3 wez  wez       60 May  6 08:15 WezTerm-20200505-090057-31c6155f-Fedora31.AppImage.config/
drwxrwxr-x.  2 wez  wez       40 May  6 08:54 WezTerm-20200505-090057-31c6155f-Fedora31.AppImage.home/
```

When launched and these `<IMAGE>.config` and/or `<IMAGE>.home` dirs
exist, the appimage machinery will redirect the HOME and XDG_CONFIG_DIR
env vars to point to those locations instead of the normal place.

We weren't respecting XDG_CONFIG_DIR (fixed in this commit), but we also
need to take care: we don't want to re-export those locations to
children of wezterm so we need to load those values and then clean
up the environment.
2020-05-06 09:11:13 -07:00
Wez Furlong
31c6155f2b wezterm: avoid weird argv0 misrepresentation with AppImage 2020-05-05 08:57:31 -07:00
Wez Furlong
e74f467c39 correctly fix #173
The real problem was an inconsistency in computing the tab bar
enablement state.  This makes the math the same in both places
and re-enables the `hide_tab_bar_if_only_one_tab` option.
2020-05-04 08:39:55 -07:00
Wez Furlong
132529cfd5 support Terminal identification sequence
This reports the TERM_PROGRAM and TERM_PROGRAM_VERSION
separated by a space.

See discussion in https://github.com/mintty/mintty/issues/881
with a more concise description of the functionality here in
this VTE issue: https://gitlab.gnome.org/GNOME/vte/-/issues/235

```bash
$ printf '\033[>q'; cat
^[P>|WezTerm 20200503-171512-b13ef15f-4-g0395639a^[\
```
2020-05-03 22:10:38 -07:00
Wez Furlong
0395639ab4 wezterm: export TERM_PROGRAM and TERM_PROGRAM_VERSION
There's some discussion about terminal identification and
there's what looks to be some consensus for adopting these
two environment variables that were pioneered by Apple.

refs: https://github.com/mintty/mintty/issues/881
2020-05-03 21:21:06 -07:00
Wez Furlong
fa32457656 cargo fmt 2020-05-02 17:39:45 -07:00
Wez Furlong
94bccf1dfb fix compilation on windows 2020-05-02 17:04:28 -07:00
Wez Furlong
7f131fa406 fix infinite recursion when enable_tab_bar is disabled
We need to gate with the config generation check as update_title
can be called during the configuration reloading process and
the tab bar state may not reflect the config until after the
config is reloaded!

refs: https://github.com/wez/wezterm/issues/173
2020-05-02 16:04:34 -07:00
Wez Furlong
14c73f7122 window: linux: set window icon
Teach the window layer about window icons and implement the
plumbing for this on X11.

For Wayland there is no direct way to specify the icon; instead
the application ID is used to locate an appropriate .desktop filename.
We set the app id from the classname but that didn't match the installed
name for our desktop file which is namespaced under my domain, so change
the window class to match that and enable the window icon on Wayland.

refs: https://github.com/wez/wezterm/issues/172#issuecomment-619938047
2020-05-02 12:07:34 -07:00
Wez Furlong
f1192471fb wezterm: lua: run_child_process CREATE_NO_WINDOW
On windows, prevent console subsystem processes spawned by
lua (such as the `wsl -l` example configuration) from momentarily
popping up and stealing the focus.  This was happening too fast
to see in most cases, but could cause the wezterm window to momentarily
repaint its title bar with lose focus before regaining it.
2020-04-12 10:49:17 -07:00
Wez Furlong
bb9504d626 wezterm: make config error window a singleton
This fixes an annoyance with the configuration error window;
previously we would spawn a new window for each error that
was discovered in the config, which cluttered up the screen
and felt irritating when iterating on the config file.

This commit reuses the connection status UI infra to make a
single persistent error log window.
2020-04-12 10:33:31 -07:00
Wez Furlong
785d41e140 launch menu: add fancy example for windows
This commit adds some helper functions that make it possible to
dynamically discover and add WSL distributions to the launcher
menu.

refs: https://github.com/wez/wezterm/issues/159
2020-04-12 08:51:11 -07:00
Wez Furlong
4858194ef4 wezterm: lua: add glob and read_dir
These functions are useful when dynamically constructing configuration.
2020-04-11 19:21:52 -07:00
Wez Furlong
065e6e7742 add launch_menu section to the configuration
refs: https://github.com/wez/wezterm/issues/159
2020-04-11 17:31:55 -07:00
Wez Furlong
79007d9c33 termwiz: line editor: allow custom editor actions
This restructures the LineEditor to allow the hosting application to
override key presses and apply custom edits to the editor buffer.

Methods for performing predefined actions and for accessing the line
buffer and cursor position have been provided/exposed to support this.

One consequence of this change is that the editor instance needs to be
passed through to the host trait impl and that means that the LineEditor
can no longer be generic over `Terminal`.  Instead we now take `&mut dyn
Terminal` which was how the majority of non-example code was using it in
any case.  This simplifies a bit of boilerplate in wezterm but adds an
extra line to the most basic examples.
2020-04-09 07:37:23 -07:00