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

2571 Commits

Author SHA1 Message Date
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
Wez Furlong
7b855fbd05 wezterm: fixup tests 2020-09-23 21:20:48 -07:00
Wez Furlong
77eabed349 docs: add note about splits/panes in master/nightly builds
refs: https://github.com/wez/wezterm/issues/157
2020-09-23 21:19:12 -07:00
Wez Furlong
74b10996dc wezterm: simplify AdjustPaneSize
refs: https://github.com/wez/wezterm/issues/157
2020-09-23 21:10:26 -07:00
Wez Furlong
84753a8261 wezterm: add ActivatePaneDirection key assignment
This allows moving to an adjacent pane in the specified direction.

refs: https://github.com/wez/wezterm/issues/157
2020-09-23 21:01:40 -07:00
Wez Furlong
97ff359a18 wezterm: add AdjustPaneSize keyassignment
This allows resizing a pane directionally.
2020-09-23 20:26:25 -07:00
Wez Furlong
86cc214344 wezterm: allow dragging pane edges to resize them
refs: https://github.com/wez/wezterm/issues/157
2020-09-23 18:01:48 -07:00
Wez Furlong
f9c9510691 wezterm: improve split positioning
The math for computing the position for nested splits was a bit off.
2020-09-23 09:19:23 -07:00
Wez Furlong
c2100d96c3 wezterm: Implement basic splits in the UI.
This commit provides the heart of the split functionality.
It adds a couple of key assignments (that are not finalized)
for splitting the active pane horizontally or vertically.

Clicking in a pane will activate it.
Selection is constrained to the active pane.
Resizing a window will grow/shrink the right/bottom side of a split.
The scrollbar applies to the active split.

There's not yet a way to resize a split at all.
There's not yet a key assignment for changing the active split.

The software renderer doesn't know how to render the splits correctly.

refs: https://github.com/wez/wezterm/issues/157
2020-09-22 22:12:11 -07:00
Wez Furlong
ec468acb40 panes: adopt zipper based bintree for managing panes
This simplifies the logic in the tab.rs module
2020-09-20 10:20:40 -07:00
Wez Furlong
c2c788b41d bintree: introduce a binary tree + zipper impl
The intent is for this to help manage panes, but it is reasonably
general purpose so it is broken out separately.
2020-09-20 08:27:44 -07:00
Wez Furlong
3d54a542bf wezterm: add PaneNode tree to Tab
This expands the data model for Tab so that it can record a binary
tree of panes; this allows for conceptually splitting a Pane either
horizontally or vertically.

None of the other layers know about this concept yet.

refs: https://github.com/wez/wezterm/issues/157
2020-09-20 08:27:44 -07:00
Wez Furlong
a6316315bb wezterm: introduce concept of Pane to the Mux model
This adds an extra level of indirection to the Mux model;
previously we allowed for Windows to contain an ordered
collection of Tabs, where each Tab represented some kind
of pty.

This change effectively renames the existing Tab trait to Pane
and introduces a new Tab container, so the new model is that
a Window contains an ordered collection of Tabs, and each Tab
can have a single optional Pane.

refs: https://github.com/wez/wezterm/issues/157
2020-09-20 08:27:32 -07:00
Wez Furlong
3484478ba2 wezterm: speculative workaround for RDP disconnect panic
Attempt to recover in the case where we cannot re-allocate
our vertex buffers; try to restore the prior dimensions
and resize the OS window to match.

refs: https://github.com/wez/wezterm/issues/265
2020-09-12 22:33:35 -07:00
Wez Furlong
d939211dc5 docs: fix typo in changelog 2020-09-12 09:39:51 -07:00
Wez Furlong
b10a33684e wezterm: fixup rpm build 2020-09-10 22:01:47 -07:00
Wez Furlong
94fb5094a4 wezterm: compile in default color schemes
Rather than scanning directories and reading in ~230 files on startup,
do the scan at build time so that we're parsing from memory rather
than local storage.

This should shave a bit of time off the startup, although I
haven't measured this, and I've only run this on a remote
linux system thus far.

refs: https://github.com/wez/wezterm/issues/264
2020-09-10 21:46:45 -07:00
Wez Furlong
3090c9bb68 fix build for windows 2020-09-10 15:00:43 -07:00
Wez Furlong
aae287c4f2 fix filedescriptor::poll on macos
Need to use the subsecond microsecond value, rather than the total
microsecond value, otherwise `select(2)` will yield EINVAL.

The wezterm changes show where this error was bubbling up
and breaking the tls client code.
2020-09-10 13:58:14 -07:00
Wez Furlong
6430952d74 cargo update 2020-09-09 09:31:37 -07:00
Wez Furlong
710ea44ba0 ci: boost freebsd resources a bit, and also build everything 2020-09-09 09:14:21 -07:00
Wez Furlong
581ef0a448 docs: 20200909-002054-4c9af461 2020-09-09 00:21:42 -07:00
Wez Furlong
4c9af46179 ci: add freebsd CI 2020-09-09 00:18:26 -07:00
Wez Furlong
9925b5b608 termwiz: more freebsd compat
refs: https://github.com/wez/wezterm/pull/258
2020-09-09 00:17:40 -07:00
Wez Furlong
fb890cbaf0 pty: bump version ready for publishing
refs: https://github.com/wez/wezterm/pull/258
refs: https://github.com/TimeToogo/tunshell/issues/8
2020-09-08 21:27:01 -07:00
Wez Furlong
38d18ac6db fix colorscheme install in the release AUR
refs: https://github.com/wez/wezterm/issues/259
2020-09-08 21:07:35 -07:00
Elliot Levin
86d66dae54
portable_pty - fix build on x86_64-unknown-freebsd target (#258)
* portable_pty - support for x86_64-unknown-freebsd target

* Update TIOCGWINSZ type conversion to use cast syntax and apply same logic to TIOCSWINSZ
2020-09-08 08:50:43 -07:00