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

3608 Commits

Author SHA1 Message Date
Wez Furlong
09e101c268 add format-tab-title event
refs: https://github.com/wez/wezterm/issues/647
2021-04-24 17:59:39 -07:00
Wez Furlong
e3fcdc9f36 add format-window-title event
This provides a flexible way for users to customize what gets
shown in the window title bar.

closes: https://github.com/wez/wezterm/pull/603
2021-04-24 16:47:26 -07:00
Wez Furlong
1f8908cddb fonts: revise cap_height adjustment
back out the portion of the cap height scaling that applied when
we knew the cap height of the primary font but not a fallback font.

That logic allowed some overly wide powerline fonts to be sized
correctly (a bit smaller), but also meant that a number of emoji
and other symbol glyphs were now undersized.

refs: https://github.com/wez/wezterm/issues/727
2021-04-24 12:02:52 -07:00
Wez Furlong
2520b6bd1d fontconfig: allow for undefined spacing case
I *think* the heart of the issue is that the problematic fonts
don't define a `spacing` property, and we were being stric
about matching it.

This commit changes the behavior to strictly match the spacing
value when it is defined, but to allow an undefined spacing
value to match.

refs: https://github.com/wez/wezterm/issues/726
2021-04-24 11:32:11 -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
87d49e45fc fix: multi-glyph tab titles
closes: https://github.com/wez/wezterm/issues/711
2021-04-23 22:51:53 -07:00
Wez Furlong
52b57ca512 fix splitting panes while a pane is zoomed
closes: https://github.com/wez/wezterm/issues/723
2021-04-23 22:32:47 -07:00
Wez Furlong
d705886b53 Add pane_focus_follows_mouse
closes: https://github.com/wez/wezterm/issues/600
2021-04-23 22:17:33 -07:00
Wez Furlong
657ed92d82 add swallow_mouse_click_on_pane_focus option
refs: https://github.com/wez/wezterm/issues/724
2021-04-23 22:17:06 -07:00
Wez Furlong
f97df9307a fix scaling for square glyphs
a copy-paste/transcription error had the y value divided by the cell
width rather than the x value.

refs: https://github.com/wez/wezterm/issues/707
2021-04-23 21:03:10 -07:00
Wez Furlong
501836fece docs: changelog for https://github.com/wez/wezterm/issues/714 2021-04-23 19:11:59 -07:00
Wez Furlong
d6cfa9c610 fix a possible panic when word-selecting off the top of viewport
refs: https://github.com/wez/wezterm/issues/713
2021-04-23 19:10:26 -07:00
Wez Furlong
ff7f097fb9 macos: fix "reflected" mouse x coordinate values
We were getting abs() of the backing-rect-adjusted value, so we need to
restore the sign to avoid what should be logically cell position "-1"
being treated as cell position "1" and so on.

With this change, the logic in the gui layer successfully clamps the x
coordinate to zero when trying to drag left off the window.
2021-04-23 18:31:44 -07:00
Wez Furlong
384b5cb6be avoid pathological line wrapping situations
refs: https://github.com/wez/wezterm/issues/714
2021-04-23 18:14:53 -07:00
Wez Furlong
115fb1e6d4 docs: mention window width/height
refs: #256
2021-04-23 17:45:55 -07:00
Dian M Fay
7ae05b5333 conditionally include process divination for quit-confirm check on any win/linux/osx instead of all 2021-04-22 23:08:53 -07:00
Wez Furlong
abf8235191
Create FUNDING.yml 2021-04-22 00:04:48 -07:00
Wez Furlong
e9372086ae ci: update actions/cache 2021-04-19 09:24:48 -07:00
Wez Furlong
9ddbcb4541 cargo update 2021-04-19 09:23:33 -07:00
Wez Furlong
2a79d2506d docs: fix typo
closes: https://github.com/wez/wezterm/issues/700
2021-04-17 11:57:48 -07:00
Wez Furlong
d6007547fe mux client: avoid unwrap in a couple of cases
propagate the likely client destroyed error instead

refs: https://github.com/wez/wezterm/issues/631
2021-04-16 09:16:22 -07:00
Wez Furlong
91cd2e22e4 prefer local/specific config for a couple more cases
Avoid using `configuration()` when there may be a more specific
config with overrides that we can resolve.
2021-04-16 09:04:51 -07:00
Wez Furlong
76353a6240 fix: InputMap reading global config instead of window overrides
refs: #656
2021-04-16 08:59:49 -07:00
Wez Furlong
fb69545daa config for the no-response bot 2021-04-15 19:09:31 -07:00
Wez Furlong
aea4fd5020 macos: ensure window is always miniaturizable
We need to keep the miniaturizable flag in even when there is no
titlebar, otherwise the miniaturize action has no effect.
2021-04-15 18:12:14 -07:00
Wez Furlong
27f4c01ea1 docs: a couple of changelog updates 2021-04-15 17:36:22 -07:00
Wez Furlong
1b12b0a23d fonts: improve font_rules behavior
We now always append the synthetic rules to the those in the config,
and include rules for generating half-bright font selection.
2021-04-15 09:43:24 -07:00
Wez Furlong
d5886e6297 changelog for fixing mouse cursor hiding
closes: https://github.com/wez/wezterm/issues/618
2021-04-14 19:42:22 -07:00
Wez Furlong
b0f5e673c6 vtparse/termwiz: prep for release 2021-04-14 13:04:23 -07:00
Wez Furlong
67d8848676 ls-fonts: refine output a bit
It now outputs something that you could conceivably put into
your config file, although the intent is to show the canonical
way to reference the individual fonts that were found, rather
than to specify a fully baked list to paste into a config.

eg:

```
; ./target/debug/wezterm ls-fonts
Primary font:
wezterm.font_with_fallback({
  -- /home/wez/.fonts/OperatorMonoSSmLig-Medium.otf, FontDirs
  {family="Operator Mono SSm Lig", weight="DemiLight"},

  -- /home/wez/.fonts/OperatorMonoSSmLig-Medium.otf, FontConfig
  {family="Operator Mono SSm Lig", weight="DemiLight"},

  -- /home/wez/.fonts/MaterialDesignIconsDesktop.ttf, FontDirs
  "Material Design Icons Desktop",

  -- /home/wez/.fonts/terminus-bold.otb, FontDirs
  {family="Terminus", weight="Bold"},

  -- /home/wez/.fonts/JetBrainsMono-Regular.ttf, FontDirs
  "JetBrains Mono",

  -- /home/wez/.fonts/NotoColorEmoji.ttf, FontDirs
  "Noto Color Emoji",

  -- /home/wez/.fonts/MaterialDesignIconsDesktop.ttf, FontConfig
  "Material Design Icons Desktop",

  -- /usr/share/fonts/terminus-fonts/ter-u32n.otb, FontConfig
  "Terminus",

  -- /home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig
  "JetBrains Mono",

  -- /home/wez/.fonts/NotoColorEmoji.ttf, FontConfig
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Last Resort High-Efficiency",

})
```
2021-04-14 09:06:02 -07:00
Wez Furlong
1f6bfd453b fontconfig: remove over-eager unloading
In earlier times, in an effort to avoid bleeding resources into
child processes, the fontconfig wrapper grew some logic to keep
track of how many fontconfig objects we'd loaded so that we could
aggressively unload it when there were none.

Since that time we've evolved differently pessimistic logic that forces
random fds closed when we spawn children so the critical need for unloading
fontconfig is no longer present.

Importantly, with the over-eager unloading, each font query we make
effectively needs to initialize fontconfig from scratch, which is a
fixed minimum cost of ~5-6ms on my system, and I've seen some traces
with a number as high as 100ms (those systems need `fc-cache` to be
run).

Removing the unloading keeps fontconfig initialized so we only pay
the 5ms cost once, then subsequent queries are in the order of 100us.
2021-04-14 07:38:01 -07:00
Wez Furlong
ac6ac53655 fonts: under-specify fontconfig pattern, match ourselves
It seems difficult/impossible to phrase precisely the constraints
that we want when making a font config query, so this changes our
queries to use relative broad family and postscriptname list operations
and then we parse and filter using our own CSS-inspired font matching
criteria.

refs: #689
2021-04-14 07:34:42 -07:00
Wez Furlong
5d386818e1 fontconfig: skip postscript name lookup if already resolved font
I put this condition at the wrong nesting level :-/
2021-04-14 07:34:42 -07:00
Wez Furlong
c54b9dc873 fonts: include the width in the fontconfig debug output 2021-04-14 07:34:42 -07:00
Wez Furlong
3fae59b01b fonts: use cap-height metric to scale fallback fonts
we now compute the ratio of the cap height (the height of a capital
letter) vs. the em-square (which relates to our chosen point size) to
understand what proportion of the font point-size that a given font
occupies when rendered.

When rendering glyphs from secondary fonts we can use the cap height
ratios of both to scale the secondary font such that its effective
cap height matches that of the primary font.

In plainer-english: if you mix say bold, italic and regular text
style in the same line, and you have different font families for
those fonts, then they will now appear to be the same height where
previously they may have varied more noticeably.

For emoji and symbol fonts there may not be a cap-height metric
encoded in the font.  We can however, improve our scaling: prior
to this commit we'd use the ratio of the cell metrics of the two
fonts to scale the icon/emoji glyph, but this could cause the glyph
to be slightly oversized as seen in https://github.com/wez/wezterm/issues/624

If we know the cap-height of the primary font then we can additionaly
apply that factor to scale the emoji to better fit the cell.

While looking at this, I noticed that the aspect ratio calculation
for when to apply to the allow_square_glyphs_to_overflow_width option
had width and height flipped :-(

See also: https://tonsky.me/blog/font-size/
refs: https://github.com/wez/wezterm/issues/624
2021-04-13 23:02:27 -07:00
Wez Furlong
adbe545d44 fix window vanishing when a tab is closed
We weren't fixing up the active tab position correctly after removing
a tab.  I think this bug crept in around the ActivateLastTab changes.

We now try harder to set active idx back to the tab that was active
prior to the remove, and ensure that we set the active index to
something within range if it was the active tab that was removed.

Refs: https://github.com/wez/wezterm/issues/690
2021-04-13 08:18:52 -07:00
Wez Furlong
776aedf97e fonts: allow specifying weight/stretch/italic for each fallback font 2021-04-12 22:30:55 -07:00
Wez Furlong
fcd7ceef5c docs: add missing docs for selection_fg and selection_bg
refs: https://github.com/wez/wezterm/issues/684
2021-04-12 09:55:35 -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
5ced58c37b Allow disabling re-sorting fallback fonts
The system locator may have a reasonable default ordering
in its list of fallbacks.

refs: #685
2021-04-12 08:03:17 -07:00
Wez Furlong
6f1664addd cargo update 2021-04-12 07:54:46 -07:00
Wez Furlong
ca1a261892 docs: changelog for https://github.com/wez/wezterm/issues/614 2021-04-11 22:37:32 -07:00
Wez Furlong
e5665e80a1 add window:toast_notification method
refs: https://github.com/wez/wezterm/issues/619
2021-04-11 22:01:06 -07:00
Wez Furlong
e6602dde7d fonts: refine font sorting and listing
Sort the available fonts list by family name (rather than full name),
then the styling attributes.

Display the font name in the preferred form for inclusion in the
wezterm config.
2021-04-11 16:53:12 -07:00
Wez Furlong
16701f61b4 fix new-tab hover calculation
refs: https://github.com/wez/wezterm/issues/677
2021-04-11 16:10:14 -07:00
Wez Furlong
903c7a47b6 fonts: refine fallback some more
* Log which codepoints we're about to perform fallback resolution for
* Rank the fallback fonts by decreasing amount of coverage
* If a fallback covers the desired codepoints, remove those codepoints
  from the set and reduce, so that we only add the minimal set of
  fallback fonts for the set of codepoints

You can see what triggered fallback processing using:

```
; WEZTERM_LOG=wezterm_font=trace wezterm -n 2> /tmp/font.txt
; grep 'fallback font' /tmp/font.txt
 2021-04-11T21:41:09.653Z TRACE wezterm_font > Looking for \u{d604}\u{c7ac}\u{be0c}\u{b79c}\u{ce58} in fallback fonts
 2021-04-11T21:41:12.132Z TRACE wezterm_font > Looking for \u{f4e9} in fallback fonts
```

refs: https://github.com/wez/wezterm/issues/559#issuecomment-817260512
2021-04-11 14:43:29 -07:00
Wez Furlong
0ab6382bb4 fix an issue where rangeset::difference with itself gave bad results 2021-04-11 14:34:15 -07:00
Wez Furlong
88e9ce8fa5 fonts: remove trace log when Face is dropped
It's overly verbose!
2021-04-10 21:37:00 -07:00
Wez Furlong
406d1044fa fonts: restore messaging about missing glyphs
Now that all platforms know whether the system fallbacks
covered the requested glyph range, it is reasonable to
restore the configuration error window to advise the user
if they are missing fonts for the text they want to display.

refs: https://github.com/wez/wezterm/issues/671
2021-04-10 21:35:58 -07:00
Wez Furlong
22c4407ae9 fonts: macos: improve fallback glyph resolution performance
Previously, we would add a list of ~100 or so fallback fonts to
the shaper's fallback list.

In pathological cases where a wide range of glyphs that have no
corresponding font are repeatedly emitted to the output, we'd
keep loading and unloading that large list of fallbacks in the
hope of finding a match.

Since that code was written, we're now able to compute the
codepoint coverage for ourselves, so teach the core text locator
how to reduce the the list of fallback fonts to just those that
contain the missing glyphs.

Furthermore, we restrict that list to just the normal/regular
weight/stretch/style fonts.

refs: https://github.com/wez/wezterm/issues/671
2021-04-10 21:10:22 -07:00