1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-11 14:25:57 +03:00
Commit Graph

234 Commits

Author SHA1 Message Date
Wez Furlong
0fcd4a847c
move uds stuff into new wezterm-uds crate
This centralizes the conditional imports and makes a home
for the IoSafe trait annotation for smol/async-io compat.
2024-05-13 17:56:57 -07:00
Wez Furlong
201fc1bf8e
deps: update xcb 2024-01-23 17:12:16 -07:00
Wez Furlong
58a2a30623
Add vendored cairo-sys-rs crate
I'm experimenting with using cairo's 2D graphics for glyph related
drawing operations, and perhaps more stuff in the UI in the future.

The challenge is that no one has yet encapsulated its build in a
cargo-friendly way.

This commit is that attempt.

The strategy is this:

* `deps/cairo` is ostensibly the same thing as https://github.com/gtk-rs/gtk-rs-core/tree/master/cairo/sys
  which is the cairo-sys-rs crate
* Its build.rs has been replaced with a version that builds from the C
  sources that are found in-tree; it will never look for the system
  cairo library
* A pair of scripts to import pixman (a required dep of cairo) and
  cairo itself in a repeatable way are include, for if/when we need
  to update the vendored sources
  Cairo is a mature library and doesn't release very often.
* The workspace sets a patch for crates.io so that cairo-rs has
  its cairo-sys-rs dep redirected to the local build.

I'm not planning to upstream this stuff to gtk-rs-core as full cairo
depends on a lot more things than are dealt with here, so it would be a
PITA to handle that generally.

This vendoring strips out things that are not used, so the cairo
library that remains:

* Is not internally thread safe; no TLS or mutex support is enabled
  in either of them. That's fine because the high level cairo-rs
  wrapper is not Send+Sync, which means that rust will only allow
  it to be used single threaded anyway.
* Only has the basic recording and image surfaces
* No platform support for win32/xlib/xcb and so on
2023-08-20 14:59:29 -07:00
Wez Furlong
fd1d614f29
patch rust-xcb until a release is made with my alignment fix
refs: https://github.com/wez/wezterm/issues/3838
refs: https://github.com/rust-x-bindings/rust-xcb/pull/230
2023-07-06 13:03:47 -07:00
Wez Furlong
f5ba73a1a2
add own open_url crate
The upstream open crate keeps making stuff async/blocking/not-working on
windows, so this is a step towards removing this dependency.

refs: https://github.com/wez/wezterm/issues/3288
2023-03-19 12:44:12 -07:00
Wez Furlong
6c86bfba39
add wezterm-blob-leases crate 2023-03-18 20:30:47 -07:00
Wez Furlong
30238acb1b
x11: potential fix for hanging IME
refs: https://github.com/H-M-H/xcb-imdkit-rs/issues/5
refs: https://github.com/wez/wezterm/issues/2819
2022-12-19 12:23:04 -07:00
Wez Furlong
8479be7465
Basic useless wgpu based rendering foundation 2022-11-18 10:03:49 -07:00
Wez Furlong
35ce2fe74d trim heap usage
I spent a few hours in heap profilers.  What I found was:

* Inefficient use of heap when building up runs of
  `Action::Print(char)`.
    -> Solve by adding `Action::PrintString(String)`
  and accumulating utf8 bytes rather than u32 codepoints.
* Inefficient use of heap when building Quad buffers: the default
  exponential growth of `Vec` tended to waste 40%-75% of the allocated
  capacity, and since we could keep ~1024 of these in cache, there's
  a lot of potential for waste.
   -> Solve by bounding the growth to 64 at a time.  This has similar
   characteristics to exponential growth at the default 80x24 terminal
   size.  May need to add a config option for this step size for users
   with very large terminals.
* Lazy eviction from the LFU caches. The underlying cache advisor is
  somewhat probabilistic and has a minimum cache size of 256, making
  it difficult to maintain low heap utilization.
   -> Solve by replacing it with a very simple LFU algorithm. It doesn't
   seem to hurt much at the default terminal size with the default
   cache sizes.  If we make the cache sizes smaller, its overhead is
   reduced.

Some further experimentation is needed to adjust defaults, but this
should help reduce heap usage.

refs: https://github.com/wez/wezterm/issues/2626
2022-10-22 17:10:36 -07:00
Wez Furlong
ba57f73bd9 deps: pick up updated rust-xcb
Might help with these:

refs: https://github.com/rust-x-bindings/rust-xcb/issues/195
refs: https://github.com/wez/wezterm/issues/2559
refs: https://github.com/rust-x-bindings/rust-xcb/issues/204
2022-10-04 07:53:46 -07:00
Wez Furlong
de89d650a3 cargo update 2022-08-21 08:51:16 -07:00
Wez Furlong
e866e9390a colorschemes: expand to include Gogh color schemes
This commit expands the toml file definition to include
metadata for the origin url, author and name.

A new sync utility fills out that metadata when it pulls from the iterm2
color schemes repo.

The utility also pulls down the scheme data json maintained by
the Gogh project: https://gogh-co.github.io/Gogh/ and converts
it to wezterm's format.

About 50% of Gogh overlaps with iterm2; we take the iterm2 versions
of those schemes by default because the iterm2 data has more info
about things like cursor and selection colors.

The sync utility is responsible for compiling the de-duplicated
set of scheme data into a form that is used by wezterm and its
docs.
2022-07-10 13:32:17 -07:00
Wez Furlong
ff593d1d6a appease dependabot security alerts
This doesn't change anything real, it just hints to dependabot
that we're using 1.1.1 and later, which we were anyway.
2022-06-15 07:38:39 -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
Wez Furlong
24c6830345 add wezterm-dynamic crate 2022-05-18 07:47:39 -07:00
Wez Furlong
4b018f564a window: point to my xcb for for IME changes
refs: https://github.com/rust-x-bindings/rust-xcb/pull/190
refs: https://github.com/H-M-H/xcb-imdkit-rs/pull/2
2022-05-08 14:02:25 -07:00
Wez Furlong
97005b8c1c termwiz: use perfect hashing for emoji variation sequences 2022-04-26 19:10:00 -07:00
Wez Furlong
601a85e12b Add wezterm-bidi crate
In order to support RTL/BIDI, wezterm needs a bidi implementation.  I
don't think a well-conforming rust implementation exists today; what I
found were implementations that didn't pass 100% of the conformance
tests.

So I decided to port "bidiref", the reference implementation of the UBA
described in http://unicode.org/reports/tr9/ to Rust.

This implementation focuses on conformance: no special measures have
been taken to optimize it so far, with my focus having been to ensure
that all of the approx 780,000 test cases in the unicode data for
unicode 14 pass.  Having the tests passing 100% allows for making
performance improvements with confidence in the future.

The API isn't completely designed/fully baked.  Until I get to hooking
it up to wezterm's shaper, I'm not 100% sure exactly what I'll need.
There's a good discussion on API in
https://github.com/open-i18n/rust-unic/issues/273 that suggests omitting
"legacy" operations such as reordering. I suspect that wezterm may
actually need that function to support monospace text layout in some
terminal scenarios, but regardless: reordering is part of the
conformance test suite so it remains a part of the API.

That said: the API does model the major operations as separate
phases, so you should be able to pay for just what you use:

* Resolving the embedding levels from a paragraph
* Returning paragraph runs of those levels (and their directions)
* Returning the whitespace-level-reset runs for a line-slice within the
  paragraph
* Returning the reordered indices + levels for a line-slice within the
  paragraph.

refs: https://github.com/wez/wezterm/issues/784
refs: https://github.com/kas-gui/kas-text/issues/20
2022-01-24 19:29:03 -07:00
Wez Furlong
e736d02d9e remove patched openssl-sys crate
The appropriate openssl-src is now used upstream
2021-11-03 06:38:20 -07:00
Wez Furlong
f1e5c59566 ssh: introduce wrapper enum
This is a pre-cursor step to adding libssh support
2021-10-19 20:33:30 -07:00
Wez Furlong
bb2c534a56 ssh: my openssl+windows ssh2 patch was published upstream
So remove my local patch
2021-10-10 07:29:54 -07:00
Wez Furlong
e83d059fc7 couple of build tweaks for git versioning and macos build perf 2021-04-23 23:29:43 -07:00
Wez Furlong
2e34f1a8dd Add wezterm ls-fonts subcommand
At this time it just shows you the fonts that your config matches
and where they came from:

```
; wezterm -n ls-fonts
Primary font:
  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Last Resort High-Efficiency", weight="Regular", stretch="Normal", italic=false)
    (<built-in>, BuiltIn)

When Italic=true:
  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=true)
    (/home/wez/.fonts/JetBrainsMono-Italic.ttf, FontConfig)

  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Last Resort High-Efficiency", weight="Regular", stretch="Normal", italic=false)
    (<built-in>, BuiltIn)

When Intensity=Bold:
  wezterm.font("JetBrains Mono", weight="Bold", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Bold.ttf, FontConfig)

  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Last Resort High-Efficiency", weight="Regular", stretch="Normal", italic=false)
    (<built-in>, BuiltIn)

When Intensity=Bold Italic=true:
  wezterm.font("JetBrains Mono", weight="Bold", stretch="Normal", italic=true)
    (/home/wez/.fonts/JetBrainsMono-Bold-Italic.ttf, FontConfig)

  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Last Resort High-Efficiency", weight="Regular", stretch="Normal", italic=false)
    (<built-in>, BuiltIn)

```

refs: #347
2021-04-12 09:44:27 -07:00
Wez Furlong
cdae65238a ssh2: on windows, link against openssl
The wincng based build doesn't recognize newer keys which makes it
impossible to connect to a reasonably up to date Fedora installation.

This commit points to my branch of ssh2-rs that has some changes to
build ssh2 against the vendored openssl that is already part of
the dependency graph for wezterm.

refs: https://github.com/wez/wezterm/issues/507
2021-03-26 10:00:43 -07:00
Wez Furlong
dbd7fc28a5 Raise minimum Rust version to 1.51, de-vendor openssl on unix
Rust 1.51 allows addressesing a long-standing TODO which was that we
shouldn't need to build a vendored copy of openssl on most sensible unix
systems.

We do require a vendored copy on macOS and Windows, but due to the way
that Cargo's feature resolver worked, it wasn't possible for this
requirement to be respected.

Rust 1.51 introduces `resolver="2"` which can deal with this feature
resolution!

https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2

The upshot of this is that building wezterm on real unix systems that
are not macos will now link against the system libssl, resulting in both
a shorter compile time and less headaches arising from having a slightly
different openssl used by wezterm than the rest of the system.

cc: @jsgf
2021-03-25 09:43:50 -07:00
Wez Furlong
b0572bbf1f Add ssh_config parser
refs: https://github.com/wez/wezterm/issues/457
2021-03-23 12:58:41 -07:00
Wez Furlong
a5ae7cef69 cargo update to pick up mlua 5.0.1 and the cross compilation fixes 2021-01-20 20:16:30 -08:00
Wez Furlong
42b95cd413 ci: generate universal binaries for macOS
This persuades the CI to install both the arm and intel flavors
of the rust toolchain on macOS, and the deploy script to generate
a universal binary.

* need big sur to build for M1
* Use cross-compilation compatible mlua from my fork for now
2021-01-13 20:11:58 -08:00
Wez Furlong
58eb8e3614 wezterm-font: move caching of freetype font size into Face
Profiling showed that set_font_size was a hotspot.  While there was
caching of the size info at the shaper layer, it was also needed in
the raster layer, so move it into the raster layer from the shaper
layer.

refs: #353
2020-11-25 09:20:14 -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
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
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
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
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
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
d4a01fa538 wezterm: bump lru dep 2020-07-08 23:44:40 -07:00
Luben Karavelov
5a76302c84 Update to allsorts-0.4 2020-06-20 12:31:11 -07:00
Wez Furlong
3f04ce3bba wezterm: remove unused failure deps, bump lazy_static 2020-06-16 17:27:06 -07:00
Wez Furlong
8250f9e4cf wezterm: set a reasonable default LANG on macos
If LANG isn't set then ask NSLocale for the language and country code
and see if we can conjure up a valid UTF-8 locale name.  If so,
export that in the LANG environment for our children to inherit.

refs: https://github.com/wez/wezterm/issues/220
refs: https://github.com/wez/wezterm/issues/216
2020-06-13 20:41:52 -07:00
Wez Furlong
e70a58e7f3 cargo update 2020-06-13 10:21:49 -07:00
Wez Furlong
24fdf27d65 misc: upgrade unicode-segmentation 2020-06-13 10:10:34 -07:00
Wez Furlong
2f3a508e99 term: make serde optional 2020-06-13 10:04:20 -07:00