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

131 Commits

Author SHA1 Message Date
Wez Furlong
ddc4c1b624 wezterm: fixup some allsorts shaping cases
* Fixes `keycap 0` by plucking out the prior character for an
  EnclosingMark
* Fixes lookahead for VariationSelector

refs: #66
2020-11-20 18:44:28 -08:00
Wez Furlong
a2a64e80a7 wezterm: update allsorts shaper
The current master of allsorts supports color fonts in both bitmap and
svg varieties.  I'm interested to see if I can teach wezterm to render
the svg based variety in a subsequent diff.

First though, it's times to dust off our allsorts shaper logic.

This commit updates to point to the current master of allsorts at the
time of writing; there's a little bit of API fanout that makes it a bit
easier to manage font fallback.

The fallback logic has been improved so that we can now successfully
fall back to the emoji font.

The shaping logic has been improved so that we turn on the options that
enable ZWJ for combining sequences of emoji, such as "man health
worker".

Running with the allsorts shaper enabled produces generally superior
emoji/ligature substitution results compared to harfbuzz with Noto Color
Emoji; the "man health worker" and the flags (eg: `flag: England`) from
the subdivsion-flag section don't get substituted at all with harfbuzz,
but do produce appropriate glyphs with allsorts.

refs: https://github.com/wez/wezterm/issues/66
2020-11-20 16:56:07 -08:00
Wez Furlong
fba2159839 deps: remove unused deps
Not all of these are needed in these crates (copypasta resulting
from splitting out modules)
2020-11-20 12:37:38 -08:00
Wez Furlong
aaf63285d2 tmux: attach control mode parser to terminal
This causes `tmux -CC attach` to enter control mode and patch
into the terminal, printing out parsed event messages.

refs: https://github.com/wez/wezterm/issues/336
2020-11-20 09:24:50 -08:00
Wez Furlong
ec55a23398 tmux: add tmux-cc crate
This crate knows how to parse data returned from the `tmux -CC` protocol.

refs: https://github.com/wez/wezterm/issues/336
2020-11-20 09:24:28 -08:00
Wez Furlong
44654f4752 wezterm: add wezterm set-working-directory
This command formats an OSC 7 escape sequence to inform the terminal
of the working directory.

It has two optional arguments:

* The hostname - if unspecified the hostname of the system will be used
* The working directory - if unspecified the working directory of the
  process will be used

This command formats the hostname and working directory into a `file://`
URL and emits an OSC 7 escape sequence.

The intent of this is to make it a bit easier to produce shell
integration scripts for various shell environments without trying
to implement URL encoding in eg: bash.
2020-11-13 09:27:14 -08:00
Wez Furlong
37a3f7db5f wezterm: add ScrollToPrompt key assignment
Adds some supporting methods for computing the `SemanticZone`s
in the display and a key assignment that allows scrolling the
viewport to jump to the next/prev Prompt zone.
2020-11-08 09:58:02 -08:00
Wez Furlong
dab2dd5025 term: cache recently decoded images
This commit introduces a small, bounded, LRU cache for recently
decoded images.

This allows the same image ID to be used in the cache that the
same image bits are repeatedly sent to the terminal.

This is advantageous because it reduces the amount of texture
space required by the gui layer.
2020-10-25 11:59:44 -07:00
Wez Furlong
f8c35f191b wezterm: add env bootstrap to mux server, too 2020-10-24 23:33:31 -07:00
Wez Furlong
21dbeb6f83 wezterm: fixup APPIMAGE environment consistently
Need to apply the same logic in wezterm-gui as we do
in the wezterm-cli.
2020-10-24 23:21:03 -07:00
Wez Furlong
ea0d8d6f11 wezterm-font: remove font-kit dep
This wasn't used by anything and the version was getting pretty stale.
Upgrading is awkward because newer versions pull in an incompatible
freetype library version.
2020-10-24 22:01:00 -07:00
Wez Furlong
7d843c6b24 wezterm: fixup win32 build for wezterm-gui changes
refs: #301
2020-10-24 17:00:07 -07:00
Wez Furlong
7e8c5a06bb split gui into wezterm-gui executable
This commit moves a bunch of stuff around such that `wezterm` is now a
lighter-weight executable that knows how to spawn the gui, talk to
the mux or emit some escape sequences for imgcat.

The gui portion has been moved into `wezterm-gui`, a separate executable
that doesn't know about the CLI or imgcat functionality.

Importantly, `wezterm.exe` is no longer a window subsystem executable
on windows, which makes interactions such as `wezterm -h` feel more
natural when spawned from `cmd`, and should allow
`type foo.png | wezterm imgcat` to work as expected.

That said, I've only tested this on linux so far, and there's a good
chance that something mac or windows specific is broken by this
change and will need fixing up.

refs: #301
2020-10-24 16:40:15 -07:00
Wez Furlong
f4066747d2 wezterm: improve texture atlas allocation
This commit uses the guillotine algorithm to assign rectangles,
which is superior to the dumb algorithm previously in use.

In addition, in the first pass of painting, if we get a texture
space error, we clear the atlas and try again without increasing
it size, which should serve as the ultimate defrag.

Subsequent passes will cause the texture to grow if needed.

refs: #306
2020-10-23 13:57:58 -07:00
Wez Furlong
cac02b3bbb Windows: fix enabling dark mode
This got broken by a recentish windows update.
2020-10-17 19:48:43 -07:00
Wez Furlong
5257e34e2c window: update to latest glium version 2020-10-11 17:07:47 -07:00
Wez Furlong
2a87c1dec7 Change cell api to avoid direct access to hyperlink/image
This allows potentially changing the struct layout
to reduce the struct size.
2020-10-11 13:12:46 -07:00
Wez Furlong
96c4750a30 termwiz: reduce Cell memory consumption by 24 bytes
Replaces SmallVec with an internal TeenyString that only
occupies a single machine word and avoids heap allocation
in the common case on most architectures.  This takes the
textual portion of Cell from 32 bytes to 8 bytes.
2020-10-11 13:08:57 -07:00
Wez Furlong
9d9f3c3c1a lua: add GuiWin and PaneObject proxies for use in script
This commit adds very basic first passes at representing the Pane
and GuiWindow types in lua script.

The `open-uri` event from 9397f2a2db
has been redefined to receive `(window, pane, uri)` parameters
instead of its prior very basic `uri` parameter.

A new key assignment `wezterm.action{EmitEvent="event-name"}` is
now available that allows a key binding assignment to emit an arbitrary
event, which in turn allows for triggering an arbitrary lua callback
in response to a key or mouse click.

`EmitEvent` passes the `(window, pane)` from the triggering window and
pane as parameters.

Here's a brief example:

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

wezterm.on("my-thingy", function(window, pane)
  local dims = pane:get_dimensions();
  wezterm.log_error("did my thingy with window " .. window:window_id() ..
    " pane " .. pane:pane_id() .. " " .. dims.cols .. "x" .. dims.viewport_rows);
  window:perform_action("IncreaseFontSize", pane);
end)

return {
  keys = {
     {key="E", mods="CTRL", action=wezterm.action{EmitEvent="my-thingy"}},
  }
}
```

refs: #223
refs: #225
2020-10-09 13:55:36 -07:00
Wez Furlong
5fb1414b69 fix clipboard on x11
This was broken by the changes in
aad493ab2a.  The issue was that the
channel send didn't wakeup the receiver.  I'm not sure why, and I tried
a couple of different async channel implementation.

Doing the simplistic solution here works reliably.
2020-10-09 11:07:18 -07:00
Wez Furlong
9397f2a2db wezterm: allow overriding the default open-uri event
This builds on the new lua event handler plumbing added
in ccea650a93 to co-opt
the default URI opening action:

```lua
wezterm.on("open-uri", function(uri)
  if uri:find("jira") then
    wezterm.log_error("do something with jira")
    wezterm.run_child_process({
      "wezterm",
      "start",
      "--",
      "jira",
      "view",
      extract_task_from_uri(uri)
    })
    -- prevent the default action from opening in a browser
    return false
  else
    -- log but allow the uri to be opened in the browser
    wezterm.log_error("clicken " .. uri)
  end
end)
```

This doesn't allow exactly the sketched out option from
issue #223 to be implemented, but may be close enough
to be useful.

refs: #223
refs: #225
2020-10-07 18:26:16 -07:00
Wez Furlong
ccea650a93 add wezterm.on(), wezterm.emit()
* `wezterm.on("event-name", func)`
* `wezterm.emit("event-name", "arg1", "arg2")`

`on` allows registering multiple functions.
`emit` will call each of the registered functions in turn, passing
a copy of the arguments.  If a handler returns false, no additional
handlers are called and `emit` will return false.  Otherwise,
once all the handlers have been called, `emit` will return true.

`emit` is capable of being called by async code.

These functions are available to the config layer, but nothing in
wezterm uses them at this time.

refs: #225
2020-10-07 08:42:06 -07:00
Wez Furlong
4acf1e3935 Upgrade mlua to 0.4, lua to 5.4 2020-10-06 18:34:29 -07:00
Wez Furlong
8d1af908bf fixup starting mux on windows
* Taught wezterm-mux-server how to `--daemonize` on windows
* Removed pty based command spawn used to spawn unix domain servers.
  This was present because it was the only way to successfully spawn
  wsl in the past.  What I'm finding today is that it doesn't work
  at all for me, generating an `0xc0000142` Application failed to
  initialize error.  A plain command builder spawn seems to work,
  so that's what we're going with.
* Ensure that we put `.exe` on executable name on windows, otherwise
  the spawn may fail.
* `Path::exists()` always returns false for unix domain sockets on
  Windows, so unconditionally try to remove the socket before binding,
  otherwise the bind will falsely fail, claiming that another process
  is already bound.

The docs for mux will need to be updated to show how to revise them
for the new mux server invocation:

```lua
  unix_domains = {
    {
      name = "wsl",
      serve_command = {"wsl", "wezterm-mux-server", "--daemonize"}
    },
  }
```
2020-10-05 20:29:47 -07:00
Wez Furlong
a9a220f43c Fix build on freebsd CI
refs: https://github.com/stjepang/futures-lite/issues/28
2020-10-05 17:19:17 -07:00
Wez Furlong
0a546d7c12 and another speculative diff to fixup windows build 2020-10-05 13:56:11 -07:00
Wez Furlong
a0b3932e6d fixup build for macos 2020-10-05 09:11:17 -07:00
Wez Furlong
aad493ab2a simplify promise crate
Implement Future and Promise in terms of a bounded channel of size 1.
2020-10-05 08:50:29 -07:00
Wez Furlong
5eb4d32004 upgrade misc deps, notably, async-task 2020-10-05 00:06:01 -07:00
Wez Furlong
3e2b86e15e fully remove daemonize crate 2020-10-04 23:08:50 -07:00
Wez Furlong
3de4851aed fixup tls mux sessions
This adopts smol more broadly, but not yet completely.
2020-10-04 21:47:12 -07:00
Wez Furlong
19cea53e35 mux: upgrade rcgen
This version no longer generates invalid CA certificates and
allows TLS connections using the internal PKI to advance
further.  Still need to debug an early disconnect.
2020-10-04 10:05:31 -07:00
Wez Furlong
e8be716cb3 clean up mux server startup
kindof a lot going on in this commit, unintentionally:

* Need the lua context set to be moved into the config crate
  otherwise configs cannot be parsed by the server and we end
  up with the default configs
* Make the server use smol for async io
* Drop the use of the daemonize crate, which I had forked anyway.
  Just inline our own tighter daemonize module
* Improve daemon spawning synchronization, however, it still needs
  work for windows to avoid blocking forever where we don't do
  daemonizing.
2020-10-04 09:39:28 -07:00
Wez Furlong
a4731fd5ab Use smol/async for the mux server unix sockets 2020-10-03 11:15:57 -07:00
Wez Furlong
b996fede7f codec: add async read/write methods 2020-10-03 11:15:57 -07:00
Wez Furlong
75dca6e972 move strip-ansi-escapes into its own crate 2020-10-03 11:15:57 -07:00
Wez Furlong
faba4d9074 move gui into wezterm crate/binary 2020-10-03 11:15:57 -07:00
Wez Furlong
0c32963f1c Move server to its own wezterm-mux-server binary 2020-10-03 11:15:57 -07:00
Wez Furlong
a07004302a move codec into is own crate 2020-10-03 11:15:57 -07:00
Wez Furlong
2af699fe79 move running_under_wsl to config crate 2020-10-03 11:15:57 -07:00
Wez Furlong
a511abb1c2 move mux to its own crate 2020-10-03 11:15:57 -07:00
Wez Furlong
5fc1227fb9 move ratelim to its own crate 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
d64dab2a2b move lua helpers into own crate 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
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
3090c9bb68 fix build for windows 2020-09-10 15:00:43 -07:00
Wez Furlong
6430952d74 cargo update 2020-09-09 09:31:37 -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