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

2597 Commits

Author SHA1 Message Date
Wez Furlong
6893adbc34 break dep from mux -> codec 2020-10-03 11:15:57 -07:00
Wez Furlong
b94c4a11f8 mux: remove dep on clientsession/pollable_channel 2020-10-03 11:15:57 -07:00
Wez Furlong
99df89eaa1 fix cargo doctest warning 2020-10-03 11:15:57 -07:00
Wez Furlong
ee6864c217 move config into its own crate 2020-10-03 11:15:57 -07:00
Wez Furlong
01445bf5b8 move font configuration enums to config module 2020-10-03 11:15:57 -07:00
Wez Furlong
35f6a3dd9d move FrontEndSelection to config module 2020-10-03 11:15:57 -07:00
Wez Furlong
e0dcf40967 move keyassignment into config module 2020-10-03 11:15:57 -07:00
Wez Furlong
d64dab2a2b move lua helpers into own crate 2020-10-03 11:15:57 -07:00
Wez Furlong
52aa9cf71b wezterm: move Pane into its own file 2020-10-03 11:15:57 -07:00
Wez Furlong
233adb5fe9 pty: update async example for more recent smol release 2020-10-03 11:15:57 -07:00
Wez Furlong
85bfc7de6f cargo update 2020-10-03 11:15:57 -07:00
Wez Furlong
316cc56ea8 wezterm: fixup processing of built-in fonts
There was a flaw in processing the built-ins; because we searched
the built-ins as part of the font dir step we'd satisfy matching
the default fallback from the in-memory fonts and it would accidentally
take precedence over the fonts provided by the system font locator.

This commit makes an explicit additional (final) step to search
the built in fonts.

refs: #263
2020-10-03 11:12:38 -07:00
Wez Furlong
b2911ccc41 wezterm: add confirm parameter to CloseCurrentTab
When confirmation is enabled, a really basic overlay is
rendered over the top of the tab to request confirmation.

The default key assignment for CloseCurrentTab now
has confirmation enabled.

```lua
action=wezterm.action{CloseCurrentTab={confirm=true}}

action=wezterm.action{CloseCurrentTab={confirm=false}}
```

refs: https://github.com/wez/wezterm/issues/157
refs: https://github.com/wez/wezterm/issues/280
2020-10-01 22:19:42 -07:00
Wez Furlong
1b9d561e56 wezterm: add confirm parameter to CloseCurrentPane
When confirmation is enabled, a really basic overlay is
rendered over the top of the pane to request confirmation.

```lua
 action=wezterm.action{CloseCurrentPane={confirm=true}}

 action=wezterm.action{CloseCurrentPane={confirm=false}}
```

refs: https://github.com/wez/wezterm/issues/157
refs: https://github.com/wez/wezterm/issues/280
2020-10-01 21:45:39 -07:00
Wez Furlong
f3bccc7d08 window: X/Wayland: Software frontend is now llvmpipe
refs: https://github.com/wez/wezterm/issues/265#issuecomment-701882933
2020-10-01 20:03:45 -07:00
Wez Furlong
e6a858664f windows: Software frontend is now mesa llvmpipe
This is a bit of a switch-up, see this comment for more background:
refs: https://github.com/wez/wezterm/issues/265#issuecomment-701882933

This commit:

* Adds a pre-compiled mesa3d opengl32.dll replacement
* The mesa dll is deployed to `<appdir>/mesa/opengl32.dll` which by
  default is ignored.
* When the frontend is set to `Software` then the `mesa` directory
  is added to the dll search path, causing the llvmpipe renderer
  to be enabled.
* The old software renderer implementation is available using the
  `OldSoftware` frontend name

I'm not a huge fan of the subdirectory for the opengl32.dll, but
I couldn't get it to work under a different dll name; the code
thought that everything was initialized, but the window just rendered
a white rectangle.
2020-10-01 18:31:57 -07:00
Wez Furlong
6069eabc9b window: speculatively try enabling mesa llvmpipe as egl fallback
If we've failed to initialize EGL, try setting `LIBGL_ALWAYS_SOFTWARE=true`
in the environment and make another pass at initialization in the hope
that it brings up something usable.

This commit only impacts linux systems at the time of writing.

I've made the line that logs the GL implementation information
have `error` level again, because it is more convenient for me
even if it isn't technically an error.

refs: https://github.com/wez/wezterm/issues/272
(but isn't the true fix; this is just trying to make the consequences
of that problem less.  I would like to get that fixed correctly)

refs: https://github.com/wez/wezterm/issues/265#issuecomment-701882933
(which discusses what I think the end state should be)
2020-09-30 22:41:02 -07:00
Wez Furlong
3f466b1fc3 wezterm: add automatically_reload_config=false option
closes: https://github.com/wez/wezterm/issues/287
2020-09-30 08:47:41 -07:00
Wez Furlong
d880c2b86f docs: update changelog for nightly 2020-09-30 08:33:21 -07:00
Wez Furlong
a773833774 wezterm: guess at cwd associated with pty on macos
As with linux, we still prefer OSC 7, but this gives a reasonable
fallback.
2020-09-30 08:17:31 -07:00
Wez Furlong
4ed2b1cd14 wezterm: fix an issue where unzooming wouldn't resize the pane
The problem was that the pane resizes got optimized away because the
tab size doesn't change as part of the zoom operation.

We don't need to run the full resize logic for unzoom though, just
need to re-apply the size to the unzoomed pane.

We don't have a convenient way to do that, so we re-apply the sizes
to all of the panes in the tab.

refs: https://github.com/wez/wezterm/issues/157#issuecomment-701173561
2020-09-30 07:33:40 -07:00
Wez Furlong
3413bd97b9 wezterm: bundle JetBrains Mono and Noto Color Emoji fonts
These serve two purposes:

* Provide a consistent default font for new installations,
  that happens to show off ligature and color emoji support
  out of the box.
* Provide a reasonable fallback in case the configuration is broken

Both fonts are distributed under the terms of the OFL 1.1.

refs: https://github.com/wez/wezterm/issues/263
2020-09-29 22:05:18 -07:00
Wez Furlong
42e135e5b0 wezterm: fix resize crash
Repro steps were:

* Split horizontal
* Resize y to be shorter; size shrinks to zero
* Resize y to be taller; size grows to u16::max and then overflows

The return statement was missing; probably a copy-n-paste-o as
the equivalent logic for the x size adjustment had it.

closes: https://github.com/wez/wezterm/issues/276
2020-09-29 20:12:43 -07:00
Wez Furlong
53c63267e8 wezterm: tidy up pane/tab/window killing, resize boundaries
This should make closing panes more consistent and reliable;
there were some cases where we wouldn't always terminate the
associated process and this improves that.

There are also some resize boundary check improvements.

refs: https://github.com/wez/wezterm/issues/157#issuecomment-700408882
refs: https://github.com/wez/wezterm/issues/157#issuecomment-700335114
2020-09-29 08:30:52 -07:00
Wez Furlong
3a47d76094 wezterm: add wezterm cli split-pane command
This is the initial pass; the output from the command needs
some thought, but it basically operates.

refs: https://github.com/wez/wezterm/issues/230
2020-09-28 09:03:46 -07:00
Wez Furlong
23c777aadd wezterm: export WEZTERM_PANE=<pane_id>
When spawning processes, export the local pane_id.

refs: https://github.com/wez/wezterm/issues/230
2020-09-27 20:04:41 -07:00
Wez Furlong
242adbbcfe wezterm: kill processes attached to panes when detaching from mux 2020-09-27 19:26:45 -07:00
Wez Furlong
b744d986af wezterm: break out of pty reader loop when pane is removed
If a pane is killed via mux manipulation, the reader didn't have
a way to notice this and could keep reading the data in a loop.

This commit adds an atomic boolean to signal back from the mux
to the reader.

This isn't perfect; the reader thread may still be blocked in
read until the underlying process is really killed.
2020-09-27 18:38:48 -07:00
Wez Furlong
c5efd94bb8 wezterm: improve pane resize logic
This uses a similar approach to that used by tmux; when resizing,
a size delta is computed in each axis and that value is distributed
across the splits in that dimension.

For a small resize by 1 cell this tends to bias towards adjusting
the top/left node.

For a large resize (eg: maximizing/restoring) the distribution tends
to share across the splits in that dimension, effectively scaling
them approximately proportionally, more or less preserving the relative
scale of the splits.

refs: https://github.com/wez/wezterm/issues/157#issuecomment-699672914
2020-09-27 16:07:08 -07:00
Wez Furlong
6eccd6d2d7 wezterm: un-zoom while calculating pane sizes in resize 2020-09-27 14:07:56 -07:00
Wez Furlong
3aed1b1327 termwiz: fix bounds checking in Line::compute_double_click_range
closes: https://github.com/wez/wezterm/issues/283
2020-09-27 12:38:58 -07:00
Wez Furlong
f4dc7a2a3a docs: fixup example 2020-09-27 12:19:25 -07:00
Wez Furlong
957cc592a6 wezterm: allow using {} (an empty table) to represent None in lua
`wezterm.action{ExtendSelectionToMouseCursor=nil}` doesn't produce an
`ExtendSelectionToMouseCursor(None)` value because a table value of
`nil` is equivalent to that key not being present and lua sees just
an empty table.

Instead we need to accept `ExtendSelectionToMouseCursor={}` a valid
way to indicate an `Option::None` which is what this commit does.

Due to weirdness that I haven't had a chance to run down, passing
that value through `wezterm.action` doesn't produce the intended
value, so I'm adjusting the docs to show to specify an alternative
syntax for this as part of this commit.

refs: https://github.com/wez/wezterm/issues/282
2020-09-27 10:45:11 -07:00
Wez Furlong
85dddc0ef1 wezterm: add some trace diagnostics for font render metrics
refs: https://github.com/wez/wezterm/issues/263
2020-09-27 09:48:33 -07:00
Wez Furlong
1eab37b677 wezterm: fix panic when a large paste is chunked in an emoji
wezterm splits pastes into chunks of 1KB.  If that chunk was in
the middle of a UTF8 multibyte sequence, the rust string library
would panic.

This commit rounds the chunk size up to the next character
boundary.

closes: https://github.com/wez/wezterm/issues/281
2020-09-27 09:38:34 -07:00
Wez Furlong
9d33073d70 wezterm: fix infinite recursion when no valid fallbacks are present
This config reproduces the issue:

```lua
local wezterm = require "wezterm"

return {
  font_size = 12.0,
  font_dirs = {"fonts"}, -- relative to this config file
  font_locator = "ConfigDirsOnly",
  font = wezterm.font_with_fallback({
    -- this is an invalid font
    "does not exist",
    -- this is a valid font, with only symbols
    "Font Awesome 5 Free Solid",
  }),
}
```

the existing protections were a bit simplistic, so now we have a
dedicated error type for this case and that stops fallback processing
from recursing.

closes: https://github.com/wez/wezterm/issues/279
2020-09-27 09:02:43 -07:00
Wez Furlong
0e8ac1851d wezterm: fixup per-pane overlay rendering and handling
refs: https://github.com/wez/wezterm/issues/157
2020-09-27 00:19:05 -07:00
Wez Furlong
146b4465ba wezterm: update mux protocol for splits
refs: https://github.com/wez/wezterm/issues/157
2020-09-26 20:14:28 -07:00
Wez Furlong
2901473314 wezterm: rename CloseActivePane to CloseCurrentPane
refs: https://github.com/wez/wezterm/issues/157#issuecomment-699532484
2020-09-26 11:52:12 -07:00
Wez Furlong
2d3f4f9bf9 wezterm: guess at cwd associated with pty on linux
We still prefer to consume the OSC 7 value, but can fall back
to guessing the cwd for a target process.
2020-09-26 11:51:21 -07:00
Wez Furlong
5031a53ff9 wezterm: add CloseActivePane key assignment
This removes the active pane from the current tab, causing the
tab to close if it was the last remaining pane in the tab.

```lua
  {key="W", mods="CTRL", action="CloseActivePane"},
```

refs: https://github.com/wez/wezterm/issues/157
2020-09-26 10:30:17 -07:00
Wez Furlong
81ba73d5b8 wezterm: display tab indices in tab bar by default
More details in the included changelog update

refs: https://github.com/wez/wezterm/issues/157#issuecomment-699520149
2020-09-26 09:52:16 -07:00
Wez Furlong
6708ea4b36 window: normalize SHIFT modifier state
When a keypress is ASCII uppercase and SHIFT is held, remove SHIFT
from the set of active modifiers.

refs: https://github.com/wez/wezterm/issues/157#issuecomment-699516096
2020-09-26 09:17:51 -07:00
Wez Furlong
121c090f22 wezterm: implement leader key binding support
This commit introduces a new `leader` configuration setting
that acts as a modal modifier key.

If leader is specified then pressing that key combination
will enable a virtual LEADER modifier.

While LEADER is active, only defined key assignments that include
LEADER in the `mods` mask will be recognized.  Other keypresses
will be swallowed and NOT passed through to the terminal.

LEADER stays active until a keypress is registered (whether it
matches a key binding or not), or until it has been active for
the duration specified by `timeout_milliseconds`, at which point
it will automatically cancel itself.

Here's an example configuration using LEADER:

```lua
local wezterm = require 'wezterm';

return {
  -- timeout_milliseconds defaults to 1000 and can be omitted
  leader = { key="a", mods="CTRL", timeout_milliseconds=1000 },
  keys = {
    {key="|", mods="LEADER|SHIFT", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
    -- Send "CTRL-A" to the terminal when pressing CTRL-A, CTRL-A
    {key="a", mods="LEADER|CTRL", action=wezterm.action{SendString="\x01"}},
  }
}
```

refs: https://github.com/wez/wezterm/issues/274
2020-09-25 21:38:49 -07:00
Wez Furlong
13dc7bd95b docs: fixup link to splits issue 2020-09-25 20:21:18 -07:00
Wez Furlong
afa9d90212 docs: document how to disable default key/mouse bindings
refs: https://github.com/wez/wezterm/issues/274#issuecomment-699285487
2020-09-25 20:07:14 -07:00
Wez Furlong
9d8839a6d9 pty: adjust examples for macOS Catalina
Seems that you need to have read everything you want before you
call waitpid, otherwise the pending data seems to be snipped and
prevented from being read.

closes: https://github.com/wez/wezterm/issues/187
2020-09-25 09:20:22 -07:00
Wez Furlong
3383bc5684 wezterm: add TogglePaneZoomState key binding (ctrl+shift+Z)
This toggles the zoom state for the active pane in the current tab.

refs: https://github.com/wez/wezterm/issues/157
2020-09-24 22:20:33 -07:00
Wez Furlong
6469cba8e1 wezterm: fix overlays to fill whole tab, not active pane size
refs: https://github.com/wez/wezterm/issues/157
2020-09-24 10:30:16 -07:00
Wez Furlong
d66ee6a5c6 wezterm: tab navigator: show number of panes in list
refs: https://github.com/wez/wezterm/issues/157
2020-09-24 10:30:05 -07:00