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

221 Commits

Author SHA1 Message Date
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
Wez Furlong
d547d938d8 term: rename crate to wezterm-term in advance of publishing
Add some more docs and remove a couple of dead bits of code.
2020-06-13 09:55:16 -07:00
Wez Furlong
d660f53f86 wezterm: render release notes as markdown in the update UI
This adds a markdown -> termwiz render helper for the update UI
to make the release notes look a bit more intelligible.
2020-06-06 06:33:54 -07:00
Wez Furlong
82261ff16d wezterm: enable scrollback in the error window
This commit doesn't do anything specific to scrollback though!
It moves the implementation of the TermWizTermTab away from
a directly manipulated Surface and over to using the term::Terminal,
making the renderer look more like the one used by the local tab
and domain implementation.

As a side effect of doing this, we get scrollback management
for free.

refs: https://github.com/wez/wezterm/issues/201
2020-06-03 08:45:03 -07:00
Wez Furlong
3468896ec1 wezterm: generate version info resource at build time
Bake in the git version info
2020-05-25 12:36:29 -07:00
Wez Furlong
845d990304 add strip-ansi-escape utility to wezterm package
I've been meaning to do this for a while: the intended purpose
is to use this to filter ansi escape sequences out of the prompt
in the shell pre-command hook.
2020-05-17 21:51:07 -07:00
Wez Furlong
d39c16c406 wezterm: check for new releases
This commit adds some plumbing that will use the github API to
probe the currently released version of wezterm, and if it is
newer than the running version, show a window with some release
information and links to the changelog and download page.

The checks can be disabled in the config (but require a restart
to take effect!) and default to checking every 24 hours.

If running an AppImage on linux, links directly to the appimage
download.  In the future I'd like to have the download button
use zsync to apply the update to the local image.
2020-05-08 22:18:31 -07:00
Wez Furlong
4858194ef4 wezterm: lua: add glob and read_dir
These functions are useful when dynamically constructing configuration.
2020-04-11 19:21:52 -07:00
Wez Furlong
5f13e487ce lua: give a nice error message when using an invalid field name
Make a reasonable suggestion to the user based on similarity with
possible field names, but don't error out.

This facilitates evolving the configuration over time, and makes
the config more forgiving of typos.
2020-03-01 09:39:14 -08:00
Wez Furlong
fa01ca59ca lua: add serde-powered to_lua_value function
This will help in implementing lua helper functions for various
config and other structures.
2020-02-29 21:46:59 -08:00
Wez Furlong
ab03147bd9 config: we can now read ~/.wezterm.lua
This allows for slightly more fancy configuration in the future, but for
now it is rather simple: your lua script returns a configuration struct
with the same shape as that from the TOML file.

A `wezterm` module is provided to the script that provides some
constants to help understand the environment in which wezterm
is running.

I want to add some helpers that make setting up the fonts feel less
weird (lots of nesting in the data model makes this weird).

The ability to conditionally construct configuration is powerful
and helps to address the broader request in
refs: https://github.com/wez/wezterm/issues/152

An example config looks like this:

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

print(wezterm.config_dir);
print(wezterm.executable_dir);
wezterm.log_error("w00t! running " .. wezterm.version
  .. " on " .. wezterm.target_triple ..  " " .. wezterm.home_dir);

return {
  enable_scroll_bar = true,
  enable_tab_bar = true,
  ratelimit_output_bytes_per_second = 400000,
  scrollback_lines = 350000,
  font_dirs = {".dotfiles/fonts"},

  window_padding = {
    left = 2,
    bottom = 2,
  },

  font = {
    font = {{
      family = "Operator Mono SSm Lig Medium",
    }},
  },

  unix_domains = {
    {
      name = "unix",
    }
  },

  ssh_domains = {
    {
      name = "localhost",
      remote_address = "localhost",
      username = "wez",
    },
  },

  tls_clients = {
    {
      name = "cubetls",
      remote_address = "cube-localdomain:8080",
      bootstrap_via_ssh = "cube-localdomain",
    },
  },

  tls_servers = {
    {
      bind_address = "192.168.1.8:8080",
    },
  },

  hyperlink_rules = {
    {
      regex = "\\b\\w+://(?:[\\w.-]+)\\.[a-z]{2,15}\\S*\\b",
      format = "$0",
    },
  },

  font_rules= {
    {
      italic = true,
      font = {
        font = {{
          family = "Operator Mono SSm Lig Medium Italic",
        }}
      },
    },

    {
      italic = true,
      intensity = "Bold",
      font = {
        font = {{
          family = "Operator Mono SSm Lig Book Italic",
        }}
      },
    },

    {
      intensity = "Bold",
      font = {
        foreground = "tomato",
        font = {{
          family = "Operator Mono SSm Lig Bold",
        }}
      },
    },

    {
      intensity = "Half",
      font = {
        font = {{
          family = "Operator Mono SSm Lig Light",
        }}
      },
    },
  },
}
```
2020-02-26 22:11:23 -08:00
Wez Furlong
18294841e9 ssh2: update to 0.8
That version has the ability to use SSH agent forwarding.
This commit doesn't enable that functionality, it's just updating
the version and adjusting for changes in the upstream.
2020-02-22 08:50:13 -08:00
Wez Furlong
1357a7f25a Enable timestamps in the logger 2020-02-14 09:46:19 -08:00
Jun Wu
f51650c891 termwiz: remove dep on palette
The palette crate has a codegen step that translates svg_colors.txt to named.rs.
That makes it hard to build using buck.

Remove the palette dependency so termwiz is easier to build using buck.

I made sure the following code:

    fn main() {
        use termwiz::color::RgbColor;
        let r = RgbColor::from_rgb_str("#02abcd").unwrap();
        let r1 = r.to_tuple_rgba();
        let r2 = r.to_linear_tuple_rgba();
        println!("r1 = {:?}", r1);
        println!("r2 = {:?}", r2);
    }

prints

    r1 = (0.007843138, 0.67058825, 0.8039216, 1.0)
    r2 = (0.000607054, 0.4072403, 0.6104956, 1.0)

before and after the change.
2020-02-11 07:45:50 -08:00