1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-21 03:39:16 +03:00
Commit Graph

2910 Commits

Author SHA1 Message Date
Wez Furlong
c6a55cd3b2 packaging: omit metalangle from macos for now
It does feel a bit more sluggish on my intel mac recently, so let
leave it out.
2020-12-17 20:18:02 -08:00
Wez Furlong
ee1d84829a fonts: font-config: stop after first match
font-config can return very long lists of fallback fonts like:

```
 2020-12-16T16:23:13.306Z TRACE wezterm_font::locator::font_config > query font-config for Pattern(Operator Mono SSm Lig Medium,DejaVu Sans,PT Sans,PT Sans Caption,Bitstream Vera Sans,DejaVu Sans,Verdana,Arial,Albany AMT,Luxi Sans,Nimbus Sans L,Nimbus Sans,Nimbus Sans,Helvetica,Nimbus Sans,Lucida Sans Unicode,BPG Glaho International,Tahoma,Comfortaa,Montserrat,URW Gothic,Nimbus Sans,Nimbus Sans Narrow,Carlito,Droid Sans,Nachlieli,Lucida Sans Unicode,Yudit Unicode,Kerkis,ArmNet Helvetica,Artsounk,BPG UTF8 M,Waree,Loma,Garuda,Umpush,Saysettha Unicode,JG Lao Old Arial,GF Zemen Unicode,Pigiarniq,B Davat,B Compset,Kacst\-Qr,Urdu Nastaliq Unicode,Raghindi,Mukti Narrow,malayalam,Sampige,padmaa,Hapax Berbère,MS Gothic,UmePlus P Gothic,Microsoft YaHei,Microsoft JhengHei,WenQuanYi Zen Hei,WenQuanYi Bitmap Song,AR PL ShanHeiSun Uni,AR PL New Sung,MgOpen Modata,VL Gothic,IPAMonaGothic,IPAGothic,Sazanami Gothic,Kochi Gothic,AR PL KaitiM GB,AR PL KaitiM Big5,AR PL ShanHeiSun Uni,AR PL SungtiL GB,AR PL Mingti2L Big5,MS ゴシック,ZYSong18030,TSCu_Paranar,NanumGothic,UnDotum,Baekmuk Dotum,Baekmuk Gulim,KacstQura,Lohit Bengali,Lohit Gujarati,Lohit Hindi,Lohit Marathi,Lohit Maithili,Lohit Kashmiri,Lohit Konkani,Lohit Nepali,Lohit Sindhi,Lohit Punjabi,Lohit Tamil,Meera,Lohit Malayalam,Lohit Kannada,Lohit Telugu,Lohit Oriya,LKLUG,Mingzat,Padauk,Nuosu SIL,FreeSans,FreeSans,Arial Unicode MS,Arial Unicode,Code2000,Code2001,sans\-serif,Roya,Koodak,Terafik,sans\-serif,sans\-serif,sans\-serif,ITC Avant Garde Gothic,URW Gothic,sans\-serif,sans\-serif,Helvetica,Helvetica Narrow,Nimbus Sans Narrow,sans\-serif,sans\-serif,sans\-serif:slant=0:weight=80:spacing=100:fontformat=TrueType) took 1.344155ms
 ```

In the context of that particular call, we only care about whether the
first result matches what we're looking up.  The fallbacks are processed
separately in a different method.

Therefore, we can skip additional processing and save a non-trivial
number of milliseconds overall parsing/re-parsing them to verify
whether they are the one we wanted to match.

refs: https://github.com/wez/wezterm/issues/379
2020-12-16 08:26:24 -08:00
Wez Furlong
7e49377313 font: avoid parsing fallback results from font-config
font-config can return a long list of fallback results for a given
font family, and we parse those to see if they match; once we've
found a match there's zero chance that that errort is helpful,
so break out of the loop.

Add some more trace logging to see if that helps.

refs: https://github.com/wez/wezterm/issues/379
2020-12-14 23:41:45 -08:00
Wez Furlong
1257e4ee95 deps: cargo update 2020-12-14 08:50:55 -08:00
Benoit de Chezelles
380f83e7df
Update matrix room url (#378)
* Update matrix room url

* Update matrix room url everywhere :D
2020-12-13 10:06:52 -08:00
Wez Furlong
2603f9d4b4 fixup mux output processing
in ab342d9c46 I started to rearrange how
the output processing thread works.  It wasn't quite right, so this
commit tidies things up.

The main change here is that there is now back-pressure from the output
parser on the reader; if it is taking a while to parse the output then
we don't buffer up so much input.

This makes operations like `find /` followed immediately by `CTRL-C`
more responsive.

With this change, I don't feel that the
`ratelimit_output_bytes_per_second` option is needed any more, so it
has been removed.
2020-12-12 08:53:45 -08:00
Wez Furlong
428b2a7f19 sixel: allow optional width and height specifier
`gosr` omits these fields:
https://github.com/mattn/go-sixel/blob/master/sixel.go#L66

We don't strictly need them; they just make the rest of the
image decode more efficient.

This also fixes `longcat` by the same author.

See also: https://twitter.com/yoichi22/status/1326294574042501122

cc: @yoichi
2020-12-11 20:27:08 -08:00
Wez Furlong
ca1cff103d deps: cargo update 2020-12-10 23:50:10 -08:00
Wez Furlong
ab342d9c46 mux: re-jigger pty output processing
This removes the ratelimiter from the mux pty output reader.
Instead, we now have two reader threads:

* One to perform blocking reads from the pty output and send them
  to the other thread
* The other thread waits for data from the first, then tries to find
  a newline character so that it can send 1+ lines of data to the
  terminal parser.  If it doesn't find any lines, it waits ~50ms for
  additional data from the first thread to bundle together eg:
  really long lines, or image protocol data.  It will keep doing this
  until no more data arrives within 50ms or until it finds a newline.
  Once no more data arrives within 50ms, it sends whatever it has
  accumulated and then blocks waiting for the next chunk

I tried a quick ctrl-c test with this; running `find /` and seeing
how easily interruptible it is, and it seems OK on my M1 mac.
I don't think we need the output rate limiter any more, but I'll
try this out on my bigger linux machine as well to see if that
feels as good.

With this change, `cat test-data/emoji-test.txt` no longer has wonky
spacing when it gets to the England flag at the bottom.

refs: https://github.com/wez/wezterm/issues/339
2020-12-10 23:47:11 -08:00
Wez Furlong
77d560029c dependabot: switch to weekly schedule
It feels like daily is too frequent, plus, `cargo update` seems
to generally do a better job.
2020-12-10 21:35:31 -08:00
Wez Furlong
8f5b5b572e ci: ubuntu 19 is EOL 2020-12-10 19:53:34 -08:00
Wez Furlong
02240891d3 ci: skip apt update for ubuntu 19.10
It's been failing for the past day
2020-12-10 19:44:49 -08:00
Wez Furlong
421155e44e rustfmt 2020-12-10 10:44:39 -08:00
Wez Furlong
eb83f28810 deps: dirs -> dirs_next
I saw that former is unmaintained, and dependabot wants
to upgrade that one.
2020-12-10 10:08:49 -08:00
Wez Furlong
c1fa08319e deps: upgrade euclid -> 0.22 2020-12-10 10:03:30 -08:00
dependabot[bot]
77fff02875 build(deps): bump openssl from 0.10.30 to 0.10.31
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.30 to 0.10.31.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.30...openssl-v0.10.31)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-10 10:02:25 -08:00
dependabot[bot]
b56606e9cb build(deps): bump http_req from 0.6.1 to 0.7.1
Bumps [http_req](https://github.com/jayjamesjay/http_req) from 0.6.1 to 0.7.1.
- [Release notes](https://github.com/jayjamesjay/http_req/releases)
- [Commits](https://github.com/jayjamesjay/http_req/compare/v0.6.1...v0.7.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-10 10:01:53 -08:00
Wez Furlong
c226cd2f58 ci: tweak gh_pages build/push 2020-12-09 22:47:57 -08:00
Wez Furlong
c72af9547a window: record raw key code in KeyEvent on Windows 2020-12-09 22:19:54 -08:00
Wez Furlong
694fec0d5d wezterm: normalize configured keys
To avoid confusing behavior, normalize the configured keys
in the same way that we normalize key presses.

In other words, this:

```lua
{
  key = "y",
  mods = "CTRL|SHIFT",
  action = "Copy",
}
```

is treated as if you wrote:

```lua
{
  key = "Y",
  mods = "CTRL",
  action = "Copy",
}
```

refs: https://github.com/wez/wezterm/issues/372
2020-12-09 17:17:20 -08:00
Wez Furlong
35880cf4b1 docs: maybe fix pages build 2020-12-09 15:58:14 -08:00
Wez Furlong
30ff3d6542 fixup build for macos after notify_rust updates 2020-12-09 14:30:18 -08:00
Wez Furlong
1635576413 deps: update notify-rust to 4 2020-12-09 14:19:07 -08:00
Wez Furlong
7aa65fef80 docs: update pages workflow 2020-12-09 14:11:42 -08:00
Wez Furlong
526df72544 textwrap -> 0.13 2020-12-09 14:07:35 -08:00
Wez Furlong
8eb0dac92c Update lru -> 0.6 2020-12-09 14:04:56 -08:00
Wez Furlong
6db583388f cargo update
(this will probably annoy dependabot)
2020-12-09 13:58:44 -08:00
Wez Furlong
22b4e99c82 tidy up default_dpi vs DEFAULT_DPI
This commit breaks the dependency from config -> window,
which in turn breaks the dependency from mux-server -> x11 libs
on linux.
2020-12-09 13:48:23 -08:00
Wez Furlong
c6334a45dd extract window::input to wezterm-input-types 2020-12-09 13:48:23 -08:00
Wez Furlong
eec27d81e3
Create dependabot.yml 2020-12-09 13:48:13 -08:00
Wez Furlong
dfde0c8809 term: revise color cube in the default palette
This commit adjusts the default color palette to use the same color
cube calculation as xterm; it isn't the ideal color cube calculation
and results in slightly brighter colors.

This commit also memoizes the default palette calculation so that
it isn't recomputed each time a palette is created.

refs: https://github.com/wez/wezterm/issues/348
2020-12-09 00:52:24 -08:00
Wez Furlong
d99b025e24 docs: link to new GitHub Discussions thingy 2020-12-08 20:32:46 -08:00
Wez Furlong
dd11fc606a ci: maybe fix centos 8
The internet suggests that the name should be lowercase.
Why this suddenly broke is beyond me.
2020-12-07 21:34:30 -08:00
Wez Furlong
2888428dda wezterm-font: add system font fallback on macOS
Teach the core text locator how to obtain the system fallback list
and add that to the fallback.

Fixup handling of ttc files on macOS; we'd always assume index 0
when extracting font info from the font descriptor.  We now make
the effort to enumerate the contents of the TTC and find a match.
2020-12-06 22:23:39 -08:00
Wez Furlong
92827a1bea wezterm: default dpi on macOS is now 72
https://wiki.lazarus.freepascal.org/Cocoa_DPI states that the dpi
on macOS is 72.  That matches up to the experimental results reported
in #332 (in which 74.0 appears about the right size).

This commit introduces a `DEFAULT_DPI` constant that is set to 72 on
macOS and 96 on other operating systems.

The result of this is that a 10 point Menlo font now appears to be
the same size in Terminal.app and WezTerm.app.

refs: https://github.com/wez/wezterm/issues/332
2020-12-06 18:34:06 -08:00
Wez Furlong
b2be2963a1 wezterm: fixup input processing for Option/dead keys
This commit improves input processing on macOS; passing the keyUp
events to the input context is required for dead keys to correct
process their state transitions.

In addition, we weren't passing key events through if any modifiers
were down; for dead keys we need to allow Option through.

This commit rigs up a little bit of extra state to avoid double-emitting
key outputs from the input context.

Lastly, the virtual key code is passed through to the KeyEvent to
enable binding to raw keys per 61c52af491

refs: #357
2020-12-06 17:49:26 -08:00
Wez Furlong
19843ba8f3 wezterm-gui: fixup compilation 2020-12-06 14:30:45 -08:00
Wez Furlong
61c52af491 wezterm: add raw_code concept to input layer
This commit is a bit noisy because it also meant flipping the key map
code from using the termwiz input types to the window input types, which
I thought I'd done some time ago, but clearly didn't.

This commit allows defining key assignments in terms of the underlying
operating system raw codes, if provided by the relevant layer in the
window crate (currently, only X11/Wayland).

The raw codes are inherently OS/Machine/Hardware dependent; they are the
rawest value that we have available and there is no meaningful
understanding that we can perform in code to understand what that key
is.

One useful property of the raw code is that, because it hasn't gone
through any OS level keymapping processing, its value reflects its
physical position on the keyboard, allowing you to map keys by position
rather than by value.  That's useful if you use software to implement
eg: DVORAK or COLEMAK but want your muscle memory to kick in for some of
your key bindings.

New config option:

`debug_key_events = true` will cause wezterm to log an "error" to stderr
each time you press a key and show the details in the key event:

```
2020-12-06T21:23:10.313Z ERROR wezterm_gui::gui::termwindow > key_event KeyEvent { key: Char('@'), modifiers: SHIFT | CTRL, raw_key: None, raw_modifiers: SHIFT | CTRL, raw_code: Some(11), repeat_count: 1, key_is_down: true }
```

This is useful if you want to figure out the `raw_code` for a key in your
setup.

In your config, you can use this information to setup new key bindings.
The motivating example for me is that because `raw_key` (the unmodified
equivalent of `key`) is `None`, the built-in `CTRL-SHIFT-1` key
assignment doesn't function for me on Linux, but I can now "fix" this in
my local configuration, taking care to make it linux specific:

```lua
local wezterm = require 'wezterm';
local keys = {}

if wezterm.target_triple == "x86_64-unknown-linux-gnu" then
  local tab_no = 0
  -- raw codes 10 through 19 correspond to the number key 1-9 positions
  -- on my keyboard on my linux system.  They may be different on
  -- your system!
  for i = 10, 20 do
    table.insert(keys, {
      key="raw:"..tostring(i),
      mods="CTRL|SHIFT",
      action=wezterm.action{ActivateTab=tab_no},
    })
    tab_no = tab_no + 1
  end
end

return {
  keys = keys,
}
```

Notice that the key assignment accepts encoding a raw key code using
a value like `key="raw:11"` to indicate that you want a `raw_code` of
`11` to match your key assignment.  The `raw_modifiers` portion of
the `KeyEvent` is used together with the `raw_code` when deciding
the key assignment.

cc: @bew
2020-12-06 13:41:29 -08:00
Wez Furlong
4e7f3cc75a window: add optional KeyCode::raw_code field
This allows stashing the raw key identifier from the keyboard layer.
Interpreting this value is hardware and OS dependent.

At this time, only X11/Wayland implementations populate this value,
and there is no way to do key assignment based upon it.
2020-12-06 13:41:29 -08:00
Wez Furlong
d6a9ed5ae7 window: x11: remove a little redundant code from key processing 2020-12-06 13:41:29 -08:00
Wez Furlong
ba9bc30b79 harfbuzz: skip some unused bits
don't bother building the coretext or uniscribe bits of harfbuzz
2020-12-05 14:19:47 -08:00
Wez Furlong
0fa2edb1f4 wezterm: fix panic in early startup
164adb78e3 added blowing some
opengl related state during resize, however, on some systems
(BigSur with M1 silicon, perhaps also Intel?) and Windows 10
can generate a resize event before we've spun up opengl, so
we need to make this conditional.

refs: #359
closes: #358
2020-12-05 10:43:20 -08:00
Wez Furlong
e86d949dae cargo update
We need a newer version of ring in order to compile on M1

refs: #343
2020-12-05 10:35:00 -08:00
Wez Furlong
bbb953610d wezterm: fix x-scale calculation
Need to account for the number of cells occupied by the glyph,
otherwise we'll always scale to a single cell for double width
glyphs.

refs: #342
2020-12-04 22:36:20 -08:00
Wez Furlong
215a3bb297 docs: link to fedora 33 nightly builds 2020-12-04 22:09:48 -08:00
Wez Furlong
ab54d1f897 Updates for building on Fedora 33 2020-11-29 10:26:11 -08:00
evs-ch
1a42b17727
Fixes building on aarch64 (#356)
827d94a seems to have broken building on aarch64. The fix is pretty
much adapted from bf962c8.
I know little about rust, so I might've missed some obvious issues with
this PR - it seems to work so far, though.
2020-11-26 20:41:04 -08:00
Wez Furlong
214390ba5a wezterm-font: remove some dead code 2020-11-25 22:12:40 -08:00
Wez Furlong
6ccef46989 wezterm-font: compute codepoint coverage for font-dirs
This commit adds support for computing the codepoint coverage for fonts
loaded from font-dirs and the built-in, in-memory fonts.

What this means is that if you have eg: a font with chinese glyphs in
your font-dirs but not explicitly listed in your wezterm config, if
chinese text is rendered and no match from your config is found, wezterm
will be able to find the font from your font-dirs and use that
implicitly.

Computing the codepoint coverage is relatively expensive so we defer it
until we need to perform it, and cache it.
2020-11-25 20:41:09 -08:00
Wez Furlong
d934a0ae88 wezterm-font: move FontDatabase into FontConfiguration
Previously, we'd enumerate the font dirs on every font resolve for
every bit of styled text.

This moves the new FontDatabase instances to be single instanced
in the FontConfiguration.  The font-dirs will be scanned once
on a config reload, but the built-in in-memory fonts will only
every be enumerated once per FontConfiguration instance.
2020-11-25 19:21:51 -08:00