1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-18 10:52:16 +03:00
Commit Graph

3223 Commits

Author SHA1 Message Date
Wez Furlong
c948fff0d2 font: make fewer overall passes to compute Names struct 2020-12-20 12:24:04 -08:00
Wez Furlong
e831032c72 wezterm: close random fds when starting wezterm-gui
Let's try to eliminate garbage that the OS gui system leaks into
us when it spawns wezterm.
2020-12-20 11:46:59 -08:00
Wez Furlong
44729a7e89 pty: avoid leaking fds from the parent process on all unices
I noticed that wezterm is picking up garbage from gnome too,
so let's trigger the random fd closing function on all unix
systems.

It turns out that iterating the entries in /dev/fd works on
BSD and Linux which is nice.
2020-12-20 11:37:03 -08:00
Wez Furlong
bda7633fa9 ci: include whole debian pkg root in the .xz ubuntu archive
I'd forgotten that the .xz tarball was a thing.  Update it to include
everything that goes into the .deb

refs: https://github.com/wez/wezterm/issues/385
2020-12-20 11:17:40 -08:00
Wez Furlong
eff3a13847 font: switch parser to ttf_parser
My original goal was to update to allsorts 0.5 but the API
changes are significant and not clearly described.

To make that transition easier, the prior commit moved the shaping
logic into our allsorts shaper module, leaving the name parsing
here in parser.rs.

This commit now replaces that logic with ttf_parser, which is
potentially faster (there's more emphasis on optimal code in that
crate than in allsorts) but definitely simpler.

It's not a slam-dunk transition: ttf_parser doesn't know how to
decode MacRoman encoded text, so there's a bit of logic borrowed
from allsorts here to handle that.
2020-12-19 21:55:24 -08:00
Wez Furlong
6bc1e50350 font: move some of the allsorts code into the shaper module 2020-12-19 18:21:52 -08:00
Wez Furlong
f59684a3b1 cargo update 2020-12-19 16:44:27 -08:00
Aaron Abramov
2eef556092
Update snapshot tests to use k9@0.10.0 (#384)
I'm gradually improving snapshot testing macro devx in k9 and preparing
to ship v1. Before i do this i'm changing the inline snapshot macro to be
just `snapshot!()` that takes `Debug` trait an an arg and figures out
serialization of it.
2020-12-19 16:43:25 -08:00
Wez Furlong
d62433eed7 changelog entry for color cube adjustment
closes: https://github.com/wez/wezterm/issues/348
2020-12-19 14:09:37 -08:00
Wez Furlong
592dbffa22 pty: avoid leaking random fds to children on macOS Big Sur
I'm assuming this is Big Sur specified, as I hadn't noticed
this until upgrading; there are a bunch of gui related files
inherited by my shell:

```
$ lsof -p $$
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF                NODE NAME
zsh     66016  wez  cwd    DIR   1,16     1760              396092 /Users/wez/wez-personal/wezterm
zsh     66016  wez  txt    REG   1,16  1331248 1152921500312774717 /bin/zsh
zsh     66016  wez  txt    REG   1,16   138640 1152921500312777271 /usr/lib/zsh/5.8/zsh/terminfo.so
zsh     66016  wez  txt    REG   1,16   174352 1152921500312777285 /usr/lib/zsh/5.8/zsh/zutil.so
zsh     66016  wez  txt    REG   1,16   138128 1152921500312777261 /usr/lib/zsh/5.8/zsh/rlimits.so
zsh     66016  wez  txt    REG   1,16   579888 1152921500312777275 /usr/lib/zsh/5.8/zsh/zle.so
zsh     66016  wez  txt    REG   1,16   341904 1152921500312777223 /usr/lib/zsh/5.8/zsh/complete.so
zsh     66016  wez  txt    REG   1,16   174752 1152921500312777257 /usr/lib/zsh/5.8/zsh/parameter.so
zsh     66016  wez  txt    REG   1,16   211584 1152921500312777225 /usr/lib/zsh/5.8/zsh/complist.so
zsh     66016  wez  txt    REG   1,16   208768 1152921500312777227 /usr/lib/zsh/5.8/zsh/computil.so
zsh     66016  wez  txt    REG   1,16  2528384 1152921500312776994 /usr/lib/dyld
zsh     66016  wez    0u   CHR   16,1 0t158834                1019 /dev/ttys001
zsh     66016  wez    1u   CHR   16,1 0t158834                1019 /dev/ttys001
zsh     66016  wez    2u   CHR   16,1 0t158834                1019 /dev/ttys001
zsh     66016  wez    8r   REG   1,16   273022 1152921500312217452 /System/Library/Extensions/AppleMetalGLRenderer.bundle/Contents/Resources/default.metallib
zsh     66016  wez   10u   CHR   16,1  0t20923                1019 /dev/ttys001
zsh     66016  wez   11u   REG   1,16    65536              576611 /private/var/folders/mg/hk5n1_9x7014sm0syzqzzn640000gn/C/com.github.wez.wezterm/com.apple.metal/16777235_322/functions.data
zsh     66016  wez   12u   REG   1,16     1276             2360034 /private/var/folders/mg/hk5n1_9x7014sm0syzqzzn640000gn/C/com.github.wez.wezterm/com.apple.metal/16777235_322/functions.list
zsh     66016  wez   13r   REG   1,16   215992             2354718 /Library/Application Support/CrashReporter/SubmitDiagInfo.domains
zsh     66016  wez   14u   REG   1,16     5232             2360053 /Users/wez/Library/Saved Application State/com.github.wez.wezterm.savedState/window_2.data
zsh     66016  wez   15u   REG   1,16    59040             2360054 /Users/wez/Library/Saved Application State/com.github.wez.wezterm.savedState/data.data
zsh     66016  wez   16w   REG   1,16     4716             2360055 /Users/wez/Library/Saved Application State/com.github.wez.wezterm.savedState/windows.plist
```

This commit iterates the list of open descriptors just prior
to calling exec and closes any that aren't the stdio (0-2) descriptors.
2020-12-19 14:01:39 -08:00
Wez Furlong
e3f91afeda config: avoid storing default color schemes in config object
This helps keep the config object a bit smaller and the trace logging
output less verbose.

We now memoize the effective palette in the config, which should shave
off a little bit of time in the renderer.
2020-12-19 10:08:41 -08:00
Wez Furlong
ad7362d3f7 add error handling to getting best match
refs: #383
2020-12-19 09:23:05 -08:00
Wez Furlong
dc83c6de2a fix locating Hasklig
The root cause of this was that I'd added a fontformat=TrueType
constraint to the fontconfig pattern and since fontconfig has
fontformat=CFF for Hasklig, it wasn't the primary font candidate.

When I cut out redundant fontconfig checks in
ee1d84829a it meant that we'd never
"see" the hasklig result that turns up ~20 or so fonts into the
fallback list.

This commit removes the TrueType constraint so that the results
are ranked correctly again.

I've also switched the main font lookup path to using an alternative
font config API that returns only the best match as that more closely
aligns our intent in this function; originally, fallback was intended
to be handled in this code path, but these days it has its own separate
method.

closes: https://github.com/wez/wezterm/issues/383
refs: https://github.com/wez/wezterm/issues/379
2020-12-19 09:12:41 -08:00
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