1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-13 07:22:52 +03:00
Commit Graph

886 Commits

Author SHA1 Message Date
Wez Furlong
75066cb522 deps: update
Main thing to note here is that the open crate has deprecated
open::that_in_background, but made open::that non-blocking.

I think this is OK, but I'm a little cagey about what will
happen with this on Windows.  We may need to spawn our own
thread for this if things go awry.
2022-06-12 20:17:48 -07:00
Wez Furlong
d85b7bf3b9 win32: add extended/enhanced key concept for win32 input mode
refs: https://github.com/wez/wezterm/issues/2009
refs: https://github.com/microsoft/terminal/issues/13134#issuecomment-1148000328
2022-06-08 07:41:19 -07:00
Wez Furlong
402e5b7382 background: round down fractional pixels when tiling 2022-06-03 09:28:24 -07:00
Wez Furlong
35f14ec34c box model: allow for eased colors to be set
I did an ad-hoc test where I set the new tab button background to
an Animated value and saw that it eased in and out.

However, this commit doesn't make anything use this yet.
2022-06-03 06:58:57 -07:00
Wez Furlong
f60e39b4c3 gui: speculative fix for #2068
refs: https://github.com/wez/wezterm/issues/2068
2022-06-02 21:06:19 -07:00
Wez Furlong
a0ad3dd378 gui: move ease/interpolation into shader
This is prep for future work where I'll be moving more of the main
monospace rendering into the box model code and factoring out
this aspect of animation.
2022-06-02 07:10:57 -07:00
Wez Furlong
3dfb570162 background: round down fractional y offsets
Otherwise there is a chance that we'll end up with a 1-pixel
transparent gap between tiled textures
2022-06-01 20:44:27 -07:00
Wez Furlong
749db1435d background: avoid allocating empty layers
Only increment the layer index if we allocated any quads into it
2022-06-01 12:07:14 -07:00
Wez Furlong
2b083cc131 background: cache computed gradient images
Avoid recomputing on each config change/reload.
2022-06-01 07:29:24 -07:00
Wez Furlong
5f56b96dd2 background: allow repeat to mirror 2022-05-31 21:49:12 -07:00
Wez Furlong
590bcf2f75 background: implement offsets and alignment 2022-05-31 19:39:28 -07:00
Wez Furlong
1360e13f24 background: use Dimension for background size 2022-05-31 12:36:47 -07:00
Wez Furlong
040cd19f88 background: allow specifying the repeat interval
Useful if you want to add smaller items to your background layers
every so often; you can specify the distance between them and make
it independent of the item height.
2022-05-31 12:11:27 -07:00
Wez Furlong
e85258a212 background: allow specifying a solid color layer
The color can have alpha and blend with other layers.
This is helpful if your image has fully transparent portions
and you want to explicitly place a color in there.
2022-05-31 08:47:28 -07:00
Wez Furlong
4cb75c154f background: allow specifying the animation speed for images
The `File` variant for background layers may now be an object
that specifes a speed factor.  That factor is applied to the
animation frame durations in the loaded image, allowing the
playback rate to be adjusted.
2022-05-31 07:32:05 -07:00
Wez Furlong
3ef533e858 background: respect alpha in background images 2022-05-30 08:51:48 -07:00
Wez Furlong
7738f89381 background: use the actual sprite width
not the width of the full texture
2022-05-30 08:05:26 -07:00
Wez Furlong
303b908f9b fmt 2022-05-30 07:24:13 -07:00
Wez Furlong
62532704c2 background: implement attachment scrolling and parallax!
```lua
return {
  background = {
    {
      source = {File="/home/wez/Downloads/grey-bricks.png"},
      -- attachment = "Scroll",
      attachment = {Parallax=0.1},
      hsb = { brightness = 0.3, },
    },
  },
}
```
2022-05-30 07:20:14 -07:00
Wez Furlong
08d2ec67dc background: refactor where we trigger background painting
moving it so that we have access to the full set of positioned panes
in a subsequent commit.
2022-05-30 07:20:14 -07:00
Wez Furlong
27511c59ef background: implement scaling and repeating options 2022-05-30 07:20:14 -07:00
Wez Furlong
77b2674f6c render multiple backgrounds with alpha
Adjusts the background rendering logic so that we now allocate
a render layer for each defined background layer. This allows
their individual opacity value to multiple and blend together.

As part of this, I noticed that the big jpegs I was using could
take 400ms or more to load, so I added a basic cache to avoid
loading the same image multiple times around a config reload.
2022-05-30 07:20:14 -07:00
Wez Furlong
5d44ed6f85 notionally allow multiple background image layers
This adds some types that will enable richer background images.

* Can specify multiple layers
* Each layer can select from image files or gradient definitions
* Layers have additional properties to specify positioning, scaling,
  tiling and whether they scroll with the viewport.

None of the additional properties are hooked up yet.
2022-05-30 07:20:14 -07:00
Wez Furlong
f857ec6a5a deps: structopt -> clap 3 2022-05-28 07:07:52 -07:00
Wez Furlong
c4a248f1a3 mux: split-pane can optionally move an existing pane into the split
This commit allows for the SplitPane internal action to use the
pane id of an existing pane as the source of the pane to be added
in the new split target, rather than spawning a new command.

This can be used to move a pane from one tab to another, and is
analagous to tmux's `join-pane` command.

refs: https://github.com/wez/wezterm/discussions/2043
refs: https://github.com/wez/wezterm/issues/1253
2022-05-27 19:47:12 -07:00
Wez Furlong
8d29631808 gui: fixup config overrides typing
refs: https://github.com/wez/wezterm/issues/2042
2022-05-27 18:41:48 -07:00
Erlend Lind Madsen
c3ea11487c gui: add Linear gradient 2022-05-26 16:45:19 -07:00
Wez Furlong
4e00b24dbf gui: allow layers to be allocated for zindex on the fly
Make the layer allocation more dynamic, which makes it
possible for the box model stuff to allocate a layer based
on the zindex for an element.

Adjust the box model code to cascade the base zindex via
the layer context so that the render stage can select
the correct layer.

This fixes up rendering tabs over the top of the right status
area.
2022-05-26 08:32:55 -07:00
Wez Furlong
b2cd800c70 fix positional modifiers on Windows
I overlooked this as part of e83f2c95f4
The positional mods need to be stripped out when looking up keymap
assignments, so let's do that.

refs: https://github.com/wez/wezterm/issues/2009
refs: https://github.com/wez/wezterm/issues/2037
2022-05-26 05:38:15 -07:00
Wez Furlong
3be4dbc878 pane select: allow bg to have alpha channel
Wraps up the changes from the following diff and allows for the modal
layer (and box model) to use alpha for poly quads.

Change the default background color for pane select to be slightly
transparent.
2022-05-25 23:25:09 -07:00
Wez Furlong
3058e245d0 Allow for multiple layers
Each layer has the same 3-pass draw that we use for the main terminal
display.

These layers allow for potentially compositing between the layers.
That is untested at the moment as the upper layers use the box model
stuff which hard-codes its work to the vb index 1 which doesn't
use regular alpha blending.
2022-05-25 20:51:36 -07:00
Wez Furlong
8cce462780 debug overlay: avoid stair case when printing log messages
Need to normalize \n to \r\n so that `wezterm.log_error("foo\nbar")`
shows up correctly in the overlay.
2022-05-25 07:34:49 -07:00
Wez Furlong
2725559fc0 paneselect: add mode parameter and a mode for swapping panes
Extends the pane selector to allow:

```
wezterm --config 'keys={{key="p", mods="CTRL", action=wezterm.action{PaneSelect={mode="SwapWithActive"}}}}'
```

to swap the active pane with the selected pane.
Similar to https://wezfurlong.org/wezterm/config/lua/keyassignment/RotatePanes.html
except that only the active and the selected panes have their positions
adjusted.

refs: https://github.com/wez/wezterm/issues/1842
refs: https://github.com/wez/wezterm/issues/1975
2022-05-24 22:52:54 -07:00
Wez Furlong
c34e9b45d4 paneselect: ctrl-g as emacs-y way to close it 2022-05-24 18:39:22 -07:00
Wez Furlong
504841f0ae revert accidental portion of prior commit 2022-05-24 09:33:49 -07:00
Wez Furlong
06db8b51aa paneselect: adjust padding/styling 2022-05-24 07:17:12 -07:00
Wez Furlong
5bf736bd21 add PaneSelect key assignment
This is still a bit of a WIP, but this commit:

* Introduces a new "Modal" concept to the GUI layer. The intent is
  that modal intercepts key and mouse events while active, and renders
  over the top of the rest of the normal display.
  I think there might be a couple of cases where key events skirt
  through this, but this is good enough as a first step.
  Also, the render is forced into layer 1 which has some funny side
  effects: if the modal choses to render transparent, it will poke
  a hole in the window because all the rendering happens together:
  there aren't distinct layer compositing passes.

* Add a new PaneSelect action that is implemented as a modal.
  It uses quickselect style alphabet -> pane label generation and
  renders the labels over ~the middle of each pane using an
  enlarged version of the window frame font.  Typing the label
  will activate that pane.  Escape will cancel the modal.

More styling and docs will follow in a later commit.

refs: #1975
2022-05-23 08:16:52 -07:00
Wez Furlong
ecd05547d5 Add SplitPane assignment
This, along with the plumbing included here, allows specifying
the destination of the split (now you can specify top/left, whereas
previously it was limited to right/bottom), as well as the size
of the split, and also whether the split targets the node at the
top level of the tab rather than the active pane--that is referred
to as full-width in tmux terminology.

https://github.com/wez/wezterm/issues/578
2022-05-21 21:09:11 -07:00
Wez Furlong
d2d4257f79 Add RotatePanes key assignment 2022-05-21 17:10:04 -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
736169a752 add min_scroll_bar_height config option
refs: https://github.com/wez/wezterm/issues/1936
2022-05-21 10:06:18 -07:00
Wez Furlong
107d3d2378 search mode can now default to searching the selection text
To do this, we split `Pattern` into the underlying pattern for the mux
layer (which is part of the codec), and another for the config layer,
so that we can specify this new mode.

At the gui layer, we translate the selection variant into the actual
selection text and map it to the mux Pattern enum.

When taking the selection text, we restrict it to just the first line.

refs: https://github.com/wez/wezterm/issues/1912
2022-05-21 07:24:50 -07:00
Wez Furlong
e8c3de9c16 copy/search mode: change scope of saved search to be per-tab
refs: https://github.com/wez/wezterm/issues/1912
2022-05-21 06:45:26 -07:00
Wez Furlong
c04d831ee5 add cell_width config to scale cell_width
This works similarly to line_height

refs: #1979
2022-05-21 06:10:03 -07:00
Wez Furlong
b312479266 quickselect: allow multiline matches
Turn on multi-line mode by default, and improve the localpane
search function to collapse runs of trailing whitespace into
just a newline.

That allows:

```
./target/debug/wezterm -n --config 'quick_select_patterns={"foo$"}'
```

to match the first line from this, but not the second:

```
printf "foo\nfoobar\n"
```

and this to match both:

```
./target/debug/wezterm -n --config 'quick_select_patterns={"^foo"}'
```

refs: https://github.com/wez/wezterm/issues/2008
2022-05-20 09:47:08 -07:00
Wez Furlong
1e61d1ea8b wayland: avoid noisy panic-within-panic on shutdown
Ensure that we eagerly clear the window map to avoid
drop-during-global-dtor related panic which confuses
the root cause of wayland protocol errors.
2022-05-20 07:54:00 -07:00
Wez Furlong
55767c69b1 quickselect: avoid jumping to bottom of viewport when activated 2022-05-20 06:16:31 -07:00
Wez Furlong
2f14d640e8 config: split out lua functions into their own crates
This shaves off some build time and allows more parallism in the build.
2022-05-19 06:48:09 -07:00
Wez Furlong
92eea8e064 restore pretty printing lua values in repl
This time with more correctly working cycle detection
2022-05-18 07:47:39 -07:00
Wez Furlong
55e7d845e9 Add cycle detection when converting lua values to dynamic 2022-05-18 07:47:39 -07:00