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

2831 Commits

Author SHA1 Message Date
Wez Furlong
9bebc811d0 window: fix build when opengl is not enabled 2020-11-22 09:24:07 -08:00
Wez Furlong
ddc4c1b624 wezterm: fixup some allsorts shaping cases
* Fixes `keycap 0` by plucking out the prior character for an
  EnclosingMark
* Fixes lookahead for VariationSelector

refs: #66
2020-11-20 18:44:28 -08:00
Wez Furlong
a2a64e80a7 wezterm: update allsorts shaper
The current master of allsorts supports color fonts in both bitmap and
svg varieties.  I'm interested to see if I can teach wezterm to render
the svg based variety in a subsequent diff.

First though, it's times to dust off our allsorts shaper logic.

This commit updates to point to the current master of allsorts at the
time of writing; there's a little bit of API fanout that makes it a bit
easier to manage font fallback.

The fallback logic has been improved so that we can now successfully
fall back to the emoji font.

The shaping logic has been improved so that we turn on the options that
enable ZWJ for combining sequences of emoji, such as "man health
worker".

Running with the allsorts shaper enabled produces generally superior
emoji/ligature substitution results compared to harfbuzz with Noto Color
Emoji; the "man health worker" and the flags (eg: `flag: England`) from
the subdivsion-flag section don't get substituted at all with harfbuzz,
but do produce appropriate glyphs with allsorts.

refs: https://github.com/wez/wezterm/issues/66
2020-11-20 16:56:07 -08:00
Wez Furlong
fba2159839 deps: remove unused deps
Not all of these are needed in these crates (copypasta resulting
from splitting out modules)
2020-11-20 12:37:38 -08:00
Wez Furlong
a498aa56af termwiz: deallocate "fat" attrs if all are none
Noticed this while looking at another issue
2020-11-20 12:37:38 -08:00
Wez Furlong
c6c87eaf7c tmux: plumbing for querying panes when control mode is started up
refs: https://github.com/wez/wezterm/issues/336
2020-11-20 09:25:01 -08:00
Wez Furlong
9442726f23 tmux: press q to detach control mode pane
refs: https://github.com/wez/wezterm/issues/336
2020-11-20 09:24:58 -08:00
Wez Furlong
91f1cc21fc mux/wezterm: move Renderable into Pane
This makes it easier to overrride/overlay inside the mux when
indicating that we are in tmux mode.

refs: https://github.com/wez/wezterm/issues/336
2020-11-20 09:24:56 -08:00
Wez Furlong
fffb9b3fa0 tmux: some plumbing for detaching and indicating tmux is active
the renderable interface is getting in the way though...

refs: https://github.com/wez/wezterm/issues/336
2020-11-20 09:24:53 -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
0b64683a60 term: allow embedding application to hook device control mode
refs: https://github.com/wez/wezterm/issues/336
2020-11-20 09:24:48 -08:00
Wez Furlong
6035e16f33 tmux: restructure a bit to capture guarded output blocks
refs: https://github.com/wez/wezterm/issues/336
2020-11-20 09:24:43 -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
6716d40222 Add note about AA shadows to changelog
(and fix a typo in the comment in the shader)

closes: #331
2020-11-20 09:10:39 -08:00
Wez Furlong
fd3c062daf cargo fmt
latest rust changed the formatting options, so reformat to
avoid the CI being unhappy.
2020-11-20 09:06:21 -08:00
Wez Furlong
8c858ae6ce wezterm: avoid "shadow" AA artifacts when fg and bg are the same
When subpixel or greyscale AA are in use, the glyph data includes
some lighter and darker shaded pixels.  That's their purpose,
but if the fg and bg color are the same, the expectation is that
the glyph is invisible and we don't want "phantom" pixels around
the character.

This commit adjusts the shader to set the color to transparent
when the fg and bg are the same, and we are not rendering a color
emoji.

refs: #331
2020-11-20 08:49:12 -08:00
Wez Furlong
9d2df980e7 More fun with actions-rs/toolchain
I don't think that https://github.com/actions-rs/toolchain/issues/124
is 100% fixed, but this should fix our CI in the meantime.
2020-11-17 12:03:24 -08:00
Wez Furlong
8b9f6aed65
speculative fix for CI (#333)
* speculative fix for CI

GitHub made a breaking change, and this may get us through
until this action is updated.

refs: https://github.com/actions-rs/toolchain/pull/114
refs: https://github.com/actions-rs/toolchain/issues/124
2020-11-16 17:28:37 -08:00
Wez Furlong
0bb02ff674 docs: note about #320 in changelog
refs: #320
2020-11-15 22:26:20 -08:00
Wez Furlong
e8ad765ff5 wezterm: add SelectionMode::SemanticZone
This makes it possible to configure wezterm to eg: triple click
on command input (or output) to select the entire input or output
without messing around trying to find the bounds.

The docs have an example of how to configure this; it requires
setting up shell integration to define the appropriate semantic
zones.
2020-11-15 22:23:18 -08:00
Wez Furlong
720a6fd9b6 wezterm: fixup dark edges on text
9892b16d40 adjusted how the text
colors are produced; it resulted in some ugly dark edges, especially
on lighter backgrounds.

This commit routes that tint via an alpha compositing helper which
produces smoother edges.

refs: #320
2020-11-15 15:17:23 -08:00
Wez Furlong
9892b16d40 wezterm-font: tidy up some font hinting/aa options
This commit more cleanly separates the load from the render flags,
and fixes up the render call; at some point this got messed up such
that we'd never end up with freetype returning subpixel format data
(LCD) and instead we'd only ever get grayscale data.

With that fixed, it's apparent that the colorization of the glyph
data was wonky in the shader so this commit also cleans this up.

refs: #320
refs: #121
2020-11-14 17:27:31 -08:00
Wez Furlong
bc1e12e0f5 wezterm: fix scaling of color emoji
If you have a primary font whose height is a bit more than double the
width then a double-wide emoji would be scaled to a bit more than two
cells in width.

This commit adjust the glyph scaling to check both the x and y scaling
to ensure that they glyph fits within the appropriate number of cells.

This has the consequence of rendering eg: the heart emoji smaller than
in previous versions; the heart glyph is typically square but the
broadly used concept of width for the heart unicode character is a
single cell.  Previously we'd incorrectly render this double wide.
I'm not sure of a way to do better than we are right now because
freetype doesn't provide much help for scaling this kind of bitmap
font AFAICS.

refs: #320
2020-11-14 13:43:30 -08:00
Wez Furlong
25bbac4171 wezterm: fixup centos packaging 2020-11-14 09:24:21 -08:00
Wez Furlong
67b2725f47 docs: expand shell integration docs 2020-11-14 09:22:20 -08:00
Wez Furlong
eb22808761 wezterm: add shell integration for bash and zsh
This commit provides a shell script that hooks into bash and zsh
to enable OSC 7 and semantic zones.

The packaging for Fedora and Debian deploys that script to
/etc/profile.d.
2020-11-14 09:07:56 -08:00
Wez Furlong
44654f4752 wezterm: add wezterm set-working-directory
This command formats an OSC 7 escape sequence to inform the terminal
of the working directory.

It has two optional arguments:

* The hostname - if unspecified the hostname of the system will be used
* The working directory - if unspecified the working directory of the
  process will be used

This command formats the hostname and working directory into a `file://`
URL and emits an OSC 7 escape sequence.

The intent of this is to make it a bit easier to produce shell
integration scripts for various shell environments without trying
to implement URL encoding in eg: bash.
2020-11-13 09:27:14 -08:00
Wez Furlong
ab87752269 wezterm: add --class option to specify window class
The class name is process-global; all windows created by that
instance of wezterm will have the same class name.

closes: #325
2020-11-13 08:15:35 -08:00
Wez Furlong
18e010f1df deps: normalize the lazy-static version 2020-11-13 08:15:35 -08:00
Wez Furlong
fc24528f21 wezterm: update conpty and openconsole
These were build from this version: https://github.com/microsoft/terminal/releases/tag/v1.4.3141.0
2020-11-12 22:06:02 -08:00
Wez Furlong
04218bb877 termwiz: fixup sixel width calculation
@yoichi reports that:

```bash
printf "\x1bPqh"
```

would panic wezterm; the issue was that the maximum x value was
only being updated for newlines and that sequence didn't include it.

refs: #217
2020-11-12 10:01:33 -08:00
Wez Furlong
c3c9ed881c wezterm: fix SpawnWindow not using cwd from current pane
There were two problems:

* It was using an old code path that didn't even try to resolve the cwd
* The NewWindow code path would "forget" the originating window and then
  fail to resolve the current pane + path from the new, empty window
  that it is building.

closes: https://github.com/wez/wezterm/issues/322
2020-11-12 08:26:35 -08:00
Wez Furlong
72492c1517 font: tidy up imports/exports a bit 2020-11-11 20:31:26 -08:00
Jeremy Fitzhardinge
cb6b1496bf Don't hard-code architecture in debian package 2020-11-11 20:31:18 -08:00
Jeremy Fitzhardinge
7bfe83da6b libpng: build NEON support for ARM and Aarch64 targets 2020-11-11 20:31:18 -08:00
Jeremy Fitzhardinge
e95c7ad855 Fix compiler warning by moving x86-64 specific variable into the guard 2020-11-11 20:31:18 -08:00
Jeremy Fitzhardinge
bf962c8b1a Use right char type for ffi binding
On aarch64, `char` is unsigned (unlike x86-64 where it's signed), so use
`c_char` for the pointer so that it always matches the architecture.
2020-11-11 20:31:18 -08:00
Wez Furlong
37a3f7db5f wezterm: add ScrollToPrompt key assignment
Adds some supporting methods for computing the `SemanticZone`s
in the display and a key assignment that allows scrolling the
viewport to jump to the next/prev Prompt zone.
2020-11-08 09:58:02 -08:00
Wez Furlong
3d0107cb75 term/termwiz: add Cell::semantic_type
This commit allows the terminal to tag cells with their semantic
type, as defined by OSC 133 escape sequences.

The gist of it is that each cell is now semantically one of:

* Output (eg: from the activity performed by the user. This is the
  default)
* Input (eg: something that the user typed as input)
* Prompt (eg: "uninteresting" chrome/UI from the shell)

The semantic type is applied almost exactly like an SGR attribute,
except that resetting SGR doesn't clear the semantic type.

Tagging the cells in this way allows for smarter UX in the future;
for example, selecting the entire input or output from the last
command without fiddling around to avoid the prompt line(s),
or "paging up" to a prior prompt rather than page.

This doc covers those escapes as used in domterm, iterm2 and other
terminals:
https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md

This is an example of how to configure the shell to emit these
sequences; I'll add a proper little blob of shell specifically
for wezterm in a later commit:
https://github.com/PerBothner/DomTerm/blob/master/tools/shell-integration.zsh
2020-11-07 11:54:22 -08:00
Wez Furlong
d896fa02b0 termwiz: add OSC 133 Semantic Marker sequences
These are proposed in a spec here:
https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md

but are also used by iTerm2 in its shell integration here:
https://iterm2.com/documentation-shell-integration.html

This commit just teaches termwiz how to encode/decode the
OSC sequences.
2020-11-07 11:54:22 -08:00
Jeremy Fitzhardinge
81d5a92b66 Build fix for no implementation for &[u8] == std::vec::Vec<u8>`
Full error
```
error[E0277]: can't compare `&[u8]` with `std::vec::Vec<u8>`
   --> wezterm-gui/src/gui/termwindow.rs:817:40
    |
817 |                     if existing.data() == data {
    |                                        ^^ no implementation for `&[u8] == std::vec::Vec<u8>`
    |
    = help: the trait `std::cmp::PartialEq<std::vec::Vec<u8>>` is not implemented for `&[u8]`

error: aborting due to previous error
```
2020-11-07 07:48:21 -08:00
Wez Furlong
5b8b41adbb window: macos: fix mouse cursor for dragging splits 2020-11-06 15:02:38 -08:00
Wez Furlong
b860c9dbda termwiz: avoid panic for some malformed escapes 2020-11-06 13:59:04 -08:00
Wez Furlong
1dfc06febb docs: changelog for the last couple of fixes 2020-11-03 09:10:55 -08:00
Wez Furlong
cfef4fd0ca wezterm: adjust pixel width and height when dragging splits
The drag would update the cell dimensions but not the pixel dimensions,
which results in weird image scaling.

refs: #312
2020-11-02 19:56:46 -08:00
Wez Furlong
7fb22d6968 term: correct cursor position after imgcat
I've had a FIXME in here for a while to check the positioning,
but never got around to it.

The onefetch folks have an app that does care about this,
so it's time to resolve it!

This commit adjusts the cursor position for the iterm case
(not the sixel case), and results in both:

running in xterm:

```
onefetch --image ~/Downloads/squirrel.png
```

running in wezterm:

```
TERM_PROGRAM=iTerm.app onefetch --image ~/Downloads/squirrel.png --image-backend=iterm
```

```
onefetch --image ~/Downloads/squirrel.png --image-backend=sixel
```

showing consistent positioning.

refs: https://github.com/wez/wezterm/issues/317
refs: https://github.com/o2sh/onefetch/pull/305
2020-11-02 18:06:05 -08:00
Wez Furlong
500bf1b376 docs: note about #316
refs: #316
2020-11-01 10:36:33 -08:00
Wez Furlong
403d002d0a window: fix potential crash with multiple egl windows on windows
I didn't actually see this crash, but the same potential problem
was present, so adjust the code as per 9712d4d03c

refs: #316
2020-11-01 10:28:17 -08:00
Wez Furlong
9712d4d03c window: fix crash with multiple egl windows on macos
This is basically the same issue as
70fc76a040 but on macOS.   Now that we're
using EGL in more places, the same sort of check needs to used in more
places!

Will need to do the same on Windows in a follow-up commit.

refs: #316
2020-11-01 10:18:40 -08:00
Wez Furlong
bb49ecca98 docs: update for 20201031-154415-9614e117 release 2020-10-31 15:51:08 -07:00