1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-28 01:06:37 +03:00
Commit Graph

627 Commits

Author SHA1 Message Date
Wez Furlong
2337c06c0f gui: new bell event for running lua when the bell is rung
This commit adjusts the the window event routing/queuing so that
a queued event can capture a pane_id other than the focused pane.

Since we only allow one queued instance of a given named event in a
window, a consequence of this is that multiple bell events coming
from different panes at the same time may race and the loser's
event will be dropped. We log a warning in that case.

refs: #3
2021-09-23 08:22:01 -07:00
Wez Furlong
a2110fed6f gui: add mouse event logging
refs: #1140
2021-09-14 08:43:55 -07:00
Wez Furlong
8282faf31f window: allow specifying window resize increments on macos and x11
This commit introduces a mechanism for specifying resize increments
for a window, and then arranges for the termwindow to set those
to match the current font cell metrics.

This should help to avoid cases where there is excess padding pixels
resulting from the window being slightly larger than computed number
of cells and the font metrics.
2021-09-08 22:57:42 -07:00
Greg V
94ede1e8f1 window: implement window movement by dragging on Wayland 2021-09-08 17:45:48 -07:00
Greg V
ce5615082c gui: cancel mouse click streak when the cursor has moved to a different cell (fixes #910)
Fast-clicking users generally expect to be able to rapidly do regular selections
or otherwise cancel double/triple/quad clicks, so significant mouse movement should end the streak.

Allowing tiny pixel movements to account for touchpads is necessary.
Fortunately, the position here is already in character grid cells, which provides enough margin for this.
Other code editors like gedit also seem to do this based on the character grid.
2021-09-08 17:38:59 -07:00
Spyros Roum
bfaf46a196 Also accept shift + y/n when asking for confirmation to close panes 2021-09-08 09:33:08 -07:00
Wez Furlong
aa61a6b065 gui: force cursor to be visible in copy mode
It appears as though kakoune hides the terminal cursor and renders
its own version of the cursor.

The hidden state was being picked up by the copymode overlay,
making it awkward to use.

This commit forces the cursor to be visible (and a block) when
copy mode is active.

closes: #1113
2021-09-06 19:51:20 -07:00
Wez Furlong
41866a0b5b gui: capture new terminal size even if we haven't setup opengl
I think this is a hangover from the older logic to figure out
the initial sizing, and I suspect that it is what is causing
refs: 1074

So this is a speculative change to see if it helps!
2021-09-06 10:19:06 -07:00
Wez Furlong
93e18b2a01 deps: colorgrad -> 0.5 2021-09-05 23:27:01 -07:00
Wez Furlong
545a8fc8a7 deps: ordered-float -> 2.8 2021-09-05 23:25:37 -07:00
Wez Furlong
fea3a527dd Fixed invisible I-beam/underline cursor w/force_reverse_video_cursor
closes: https://github.com/wez/wezterm/issues/1076
2021-09-04 14:24:58 -07:00
Wez Furlong
4c8ccf8efc Add Multiple key assignment
refs: https://github.com/wez/wezterm/pull/1091
2021-09-04 13:01:34 -07:00
Wez Furlong
bc4ed3735d Add SendKey key assignment
refs: https://github.com/wez/wezterm/pull/1091
2021-09-03 12:07:17 -07:00
Wez Furlong
97831848cb gui: also log current size during a resize event
refs: #947
2021-09-02 09:18:32 -07:00
Wez Furlong
d38ba13211 render: 3 layers with dual source blending only for the glyph layer
This splits rendering into 3 passes:

* background pass for z-index < 0.  This is for solid background colors,
  background images, and image attachments with z-index < 0.
  Rendered with regular alpha blending.
* glyph pass: for glyphs at z-index==0. This is rendered with dual
  source blending enabled to facilitate subpixel aa appearance.
* top layer pass for z-index >= 0 graphics.  This is rendered with
  regular alpha blending.

This avoids weird effects, like images with alpha shining through
the back of the window when the window itself isn't transparent.

refs: #544
2021-08-24 08:53:33 -07:00
Wez Furlong
5629e0c1ca deps: tiny-skia -> 0.6 2021-08-23 07:48:13 -07:00
Wez Furlong
98206f0bf8 gui: take another pass at alpha/gamma stuff
The prior commit wasn't right, this looks better!

refs: #1049
2021-08-19 19:11:59 -07:00
Wez Furlong
66ff7740c4 gui: tweak alpha/color mask to avoid incorrect transparency
transparent images weren't always blending correctly, and were
instead shining through.

This might also have affected cursors.

It may also be a factor in a couple of recent reports of excessive
boldness which looked like funky over-alpha multiplication.

Let's see what people say about this.
2021-08-19 10:07:06 -07:00
Wez Furlong
c6e1889b04 remove unused alt alpha blending config
This doesn't make sense in a dual source blending world
2021-08-19 09:41:48 -07:00
Wez Furlong
571c137955 gui: gamma fixup
This makes the comparison in https://github.com/wez/wezterm/issues/544
work for me on mac, linux (x11, wayland) and also on Windows but
only using WGL.

It looks like we can use the proper colorspace on all targets
except for ANGLE EGL.  For whatever reason, the combination of
glium and ANGLE EGL on windows over-gamma corrects.

AFAICT, the framebuffer and perhaps the surfaces it creates
don't indicate srgb support, and whatever combination of status
they return tickles glium's srgb stuff the wrong way.

I think the "solution" is just to directly use WGL by default.

EGL was on by default because it tended to be more survivable
when graphics card drivers were updated, but the last couple
of times I updated mine it still killed wezterm anyway.

refs: #544
2021-08-19 09:17:09 -07:00
Wez Furlong
2013718336 gui: avoid divide by zero for glyphs that report num_cells=0
refs: https://github.com/wez/wezterm/issues/1042
2021-08-18 08:33:53 -07:00
Wez Furlong
769f632a26 gui: avoid making a transparent hole under the cursor 2021-08-16 08:32:49 -07:00
Wez Furlong
3e80854bc7 gui: apply hsv transform to background colors
refs: #1025
2021-08-16 08:07:22 -07:00
Wez Furlong
ab21910d80 deps: update bitflags -> 1.3 2021-08-15 18:21:17 -07:00
Wez Furlong
e1ee1ddd97 gui: disable zone fetch in the renderer
We need a more scalable alternative to this before we can use
it in the renderer.
2021-08-15 15:58:51 -07:00
Wez Furlong
67e4516c03 gui: fix seqno for semantic zone cache 2021-08-15 13:42:09 -07:00
Wez Furlong
a7b20443ba gui: add more generic dragging concept, fixup scrollbar math
Add a more general dragging thingy and use that to know when we
are dragging splits or the scroll thumb.

Fixup scrollbar math, which didn't account for whether the tabbar
was shown and which might cause the scroll thumb to jump around
on first drag (resolves #568)
2021-08-15 13:41:38 -07:00
Wez Furlong
befdc7ac3a Fixed: text_background_opacity was not respected 2021-08-15 08:33:09 -07:00
Wez Furlong
ab8c8dc6c9 gui: add UIItem concept
The idea here is to make it a bit easier to do hit detection for UI
elements; today we've been duplicating position math between the render
and the mouse movement handlers, with both pieces of code knowing the
location of the UI element.

UIItem allows the render phase to record the position, which allows
the mouse phase to be a more independent lookup against the registered
elements.

This makes it easier to add more UI elements in the future.
2021-08-15 07:46:06 -07:00
Wez Furlong
0bbb8cc37c gui: add semantic zone cache 2021-08-14 21:43:53 -07:00
Wez Furlong
eabb84b974 gui: fix: respect dynamic color scheme backgrounds
Ensure that we respect the dynamic color scheme that is configured
in a given pane.
2021-08-14 12:12:27 -07:00
Wez Furlong
0a5a4cb642 cleanup: remove bg color from vertex
Now that we have dual-source blending, this is unused
2021-08-14 11:02:56 -07:00
Wez Furlong
615b5b3966 gui: support radial gradients 2021-08-13 17:38:33 -07:00
Wez Furlong
d9e0340a94 gui: add some randomness to gradients to avoid banding 2021-08-13 13:35:55 -07:00
Wez Furlong
746951416b gui: tidy up gradient calculation 2021-08-13 12:14:14 -07:00
Wez Furlong
d59898987a gui: fix lost sync with the cell position in the renderer
If a cell contained a ligature, the math used to track where the
next quad was going to be placed could lose consistency with
the cluster/shaping information and result in offset glyphs.

This was most noticeable to me in tab titles in the tab bar;
my shell dotfiles append `-- something` to the title when a
command is launched, and the `--` is a ligature in my font.

I think I've also seen this mess up positioning in the notcurses
demo as well.

The solution is to take the cluster initial cell index rather
than trying to reverse engineer it from incomplete info.
2021-08-13 09:34:36 -07:00
Wez Furlong
cbfb6d59c5 added new window_background_gradient config option 2021-08-12 23:08:38 -07:00
Wez Furlong
6f78ee4f14 deps: update unicode-segmentation to 1.8 2021-08-11 23:06:17 -07:00
Wez Furlong
0866e5d213 fonts/shaping: respect the Presentation selection for a cluster
This commit annotates fonts with a boolean that indicates whether
we think it contains glyphs with emoji presentation, and then
passes the cluster.presentation field down to the shaper.

If the presentation doesn't match the current font in the fallback,
then it will be skipped until we exhaust its options.

`wezterm ls-fonts` also shows whether we think a font has emoji
presentation.

refs: #997
2021-08-11 09:11:59 -07:00
Wez Furlong
ee71d478c4 window+gui: enable dual source blending
This replaces the slightly gnarly subpixel enabled blending in the
shader with Dual Source Blending, which is a technique where the
fragment shader can specify both the primary color (RGBA) as well
as an additional per-channel mask that can be used to alpha blend
with the destination.

This enables artifact-free alpha blending when used together
with a transparent window background.

refs: https://github.com/wez/wezterm/issues/932
2021-08-10 18:23:18 -07:00
Wez Furlong
89f9512cc1 gui: use solid color block for background color quads
like 2facc465ef but for
cells with a background color
2021-08-09 08:48:20 -07:00
Wez Furlong
2facc465ef gui: avoid sampling solid background color
eg: white could have a greyish border from where the texture sampling
was picking up the transparent padding in the texture atlas.
2021-08-09 08:19:27 -07:00
Wez Furlong
827adf3a95 gui: try to gracefully handle both resize and scaling changes
refs: #695
2021-08-08 14:43:41 -07:00
Wez Furlong
eae327efcc model: replace LineBits::DIRTY with a sequence number
Terminal now maintains a sequence number that increments
for each Action that is applied to it.

Changes to lines are tagged with the current sequence number.

This makes it a bit easier to reason about when an individual
line has changed relative to some point in "time"; the consumer
of the terminal can sample the current sequence number and then
can later determine which lines have changed since that point
in time.

refs: https://github.com/wez/wezterm/issues/867
2021-08-08 12:45:08 -07:00
Wez Furlong
9617c742cf gui: try harder to deal with tiling wm resizing + dpi changes
refs: #695
2021-08-07 22:32:52 -07:00
Wez Furlong
5a9bd14d89 gui: fix newlines in copied text
Use the newer logical line method in pane rather than going
via the hyperlink function, so that we can better reason
about physical vs. logical line breaks, and get the results
very slightly faster too.

refs: #874
2021-08-07 19:16:29 -07:00
Wez Furlong
6d9957e6e3 term, gui: allow tracking multiple buttons
We were previously only remembering the most recently pressed
button, but that's a lossy thing to do.

This commit remembers the button presses so that we can correctly
report all press/release events.

refs: #973
2021-08-07 18:37:38 -07:00
Wez Furlong
1344b243d8 gui: allow dispatching resize events during creation
I think this is the heart of the initial size issues:
during creation, if the dpi or size is different, we generate
a resize event, but because it is dispatched before we've
assigned self.window, we weren't able to resize the window
to fit.

This commit passes the Window object down to the resize
handler so that it can do that; the diff is conceptually
small but there is corresponding fanout around ensuring
that the Window is passed down through all the resize
related codepaths that need it.

refs: #1002
refs: #695
2021-08-07 10:07:32 -07:00
Wez Furlong
e143db2b7f gui: tidy up initial resize/scale adjustment
It seems like this is making things worse on X11/Wayland.
Let's try simply skipping it--that seems fine on X11/Wayland,
but needs to be verified on macOS and Windows.

refs: #1002
refs: #695
2021-08-07 09:45:33 -07:00
Wez Furlong
308f3a8d74 window: avoid resizing on startup if the size doesn't appear different
The intent is to avoid weirdness with Wayland where we need to wait for
a configure event before we try to set the window size programmatically.

refs: #1002
2021-08-06 19:37:08 -07:00
Wez Furlong
79165617b1 window: add WindowState concept
WindowState is a bitfield that can represent maximized, full screen
and hidden window states.

WindowState is passed along with resize events, improving on the
prior basic is_full_screen boolean by representing the other states.

Notably, WindowState::MAXIMIZED is used to represent a state where
the window's size is constrained by some window environment function;
it could be due to the window being maximized in either or both the
vertical or horizontal directions, or by the window being in a tiled
state on any edge.

When the window is MAXIMIZED, wezterm will behave as though
`adjust_window_size_when_changing_font_size = false` because it knows
that it cannot adjust the window size in that state.

This potentially helps with #695, depending on whether the window
manager propagates this state information to wezterm.  Gnome/mutter
does a good job at this with both X11 and Wayland, but I couldn't get
sway to report these states and I don't know of any other tiling wm
that I can easily install and use on fedora, so there's a question
mark around that.
2021-08-06 18:56:37 -07:00
Wez Furlong
0158e8e49a gui: fixup window transparency 2021-08-06 13:07:50 -07:00
Wez Furlong
40bb5ddb97 gui: maybe fix weird bg color issue on Intel macs
This commit changes the full surface fill to be fully transparent,
and adds a separate quad to fill with the configured window background
color.

The thesis is that this should avoid the apparent weird rgb/srgb
mismatch that seems to occur with the window background on Intel macs
(those have a different OpenGL implementation than M1 based macs which
don't appear to have this issue).

refs: https://github.com/wez/wezterm/issues/1000
refs: https://github.com/wez/wezterm/issues/653
2021-08-06 09:51:57 -07:00
Wez Furlong
b883627ba1 gui: work harder to preserve initial terminal size
I noticed that on macos, the initial terminal size didn't
match the 80x24 default; it was a few columns short.

I think I broke this with recent changes in window
event dispatching.

This commit passes the terminal size down to apply_dimensions
just after we've set up the GL context to preserve the
terminal size.

Possibly related to https://github.com/wez/wezterm/issues/1002
2021-08-06 09:26:29 -07:00
Wez Furlong
aac4d36d6e gui: make a separate quad allocation pass for image cells
This should help to avoid artifacts in the case where glyphs
render outside their nominal terminal cell (happens when the
shaper tweaks positioning, and/or when ligatures are involved).

Previously we'd render the layers in z-index order for cell N
before the layers in z-index order for cell N+1.

If N had an image that overlayed the text (nominally z-index 0.5!)
and the glyph in N+1 (z-index 0) was slightly to the left of its
border, then it could layer incorrectly over the cell to the left.
2021-08-06 08:57:19 -07:00
Wez Furlong
3ea13fb530 kitty img: tidy up blit and bounds check, skip 0 duration root frame 2021-08-05 23:59:35 -07:00
Wez Furlong
c10288bd25 improve rgbcolor_alpha_to_window_color fidelity
The underlying types in termwiz support 10-bit color, but in our
conversion to the data we pass to the vertex, we were forcing it
into 8-bit and then converting to float.

Simplify this by skipping the intermediate 8-bit representation
and just go directly to float.
2021-08-05 20:37:33 -07:00
Wez Furlong
64fc58583e Tidy up outputs_srgb option
It's always on; simplify the code and just set it in the constructor
directly without passing it down from the caller.
2021-08-05 20:33:56 -07:00
Wez Furlong
17fc41fc52 add option to select alternative alpha blending
I'm not sure if this is needed now that we have a single draw call, but
based on the history and the nuance of different gl/driver/os quirks it
feels like a good idea to keep this option in the back pocket.
2021-08-04 15:26:48 -07:00
Wez Furlong
b6c6cef876 refactor: move cursor sprite generation to be dynamic
This allocates cursor sprites as needed, and uses the Poly drawing
code from the customglyph module to do it.
2021-08-04 10:01:21 -07:00
Wez Furlong
4e1f933e00 add some more eighth custom glyphs 2021-08-04 00:20:56 -07:00
Wez Furlong
524f9ddd40 render double-wide cursor for double-wide cells 2021-08-03 12:27:24 -07:00
Wez Furlong
07bea8c269 gui: change image frame caching scheme to use frame hash
Since we can now mutate individual frames, we need to avoid
falsely caching across a change; switch from using (image_id, frame_idx)
to frame_hash.

refs: #986
2021-08-03 08:42:39 -07:00
Wez Furlong
29a64e10b8 allow locking ImageData's ImageDataType for mutation
refs: #986
2021-08-02 21:35:57 -07:00
Wez Furlong
90b16b9518 move image decoding into termwiz
Adds a use_image feature to termwiz that enables an optional
dep on the image crate.  This in turn allows decoding of animation
formats (gif, apng) from file data, but more crucially, allows
modeling animation frames at the termwiz layer, which is a pre-req
for enabling kitty img protocol animation support.

refs: #986
2021-08-02 21:35:50 -07:00
Wez Furlong
76681c9879 refactor: split custom glyph code into its own file 2021-08-01 22:06:04 -07:00
Wez Furlong
86bf251f3f add some more metrics around get_lines_with_hyperlinks_applied + others 2021-08-01 14:50:50 -07:00
Wez Furlong
887152a13d Improve UX when we run out of texture space
Rather than leaving the frame un-rendered, this commit arranges
to make one last pass but with all image quad assignments skipped.

This should at least make a reasonable effort at displaying text
on the screen.

refs: https://github.com/wez/wezterm/issues/879
2021-08-01 11:29:50 -07:00
Wez Furlong
94d409d340 prefer to hold rgba8 rather than png data for kitty, sixel
I noticed when running the notcurses demo that we're spending a
decent amount of time decoding png data whenever we need to
re-do the texture atlas.

Let's avoid that by allowing for ImageData at the termwiz layer
to represent both the image file format and decoded rgba8 data.

This commit is a bit muddy and also includes some stuff to try
to delete placements from the model.  It's not perfect by any
means--more expensive than I want, and there's something funky
that causes a large number of images to build up during some
phases of the demo.

refs: #986
2021-08-01 11:29:50 -07:00
Wez Furlong
503d3df368 Constrain texture size to that supported by gpu
OpenGL will silently let us allocate a texture larger than the GPU can
bind to a sampler, reporting the error status out of band and leaving
the display in a perma-broken state.

This commit deliberately checks against the max texture size and raises
an error in that case.

The recovery story isn't perfect, but at least the texture remains
usable, so the user can clear the screen and still be able to see glyphs
afterwards.

refs: https://github.com/wez/wezterm/issues/879
2021-08-01 10:42:57 -07:00
Wez Furlong
09220adb07 simplify rendering pane splits
Just use a single quad for a given split

refs: #986
2021-07-31 20:34:36 -07:00
Wez Furlong
bbe019db96 implement kitty image source and offset options for placement
Allows selecting a source "sprite" from the image data, and offsetting
its position within the cell.

refs: #986
2021-07-31 14:03:27 -07:00
Wez Furlong
54f435b904 Restore bg_color to the vertex
Until we have dual source blending, we need the background color
in order to have a more visually pleasing alpha blend.

refs: #986
refs: #932
2021-07-31 10:44:27 -07:00
Wez Furlong
e165cdf210 Consolidate shader logic
Now that we have a single pass, we don't need to "include" snippets,
and that makes the shaders a lot easier to follow.

refs: #986
2021-07-31 07:34:14 -07:00
Wez Furlong
725572de9c reduce to a single draw call
Taking further advantage of dynamic quad allocation, we can now
remove the multiple render passes in favor of allocating the quads
and painting them from back to front.

In turn, this means that we can reduce the amount of data that we
store in the vertex, which simplifies the shaders a bit, at the
expense of making the render code in rust a bit more complex.

However, we can take advantage of stretching runs of cells with
background colors in to a single quad.

refs: #986
2021-07-31 00:23:16 -07:00
Wez Furlong
9a8b2e1e81 fix log level when loading background image 2021-07-30 20:06:41 -07:00
Wez Furlong
175ca9f722 remove draw pass 4
This was added in 365a68dfb8 to free the
orca from its cage.  With the recent dynamic quad allocation changes, we
don't need a distinct 4th pass any more and can simply layer a separate
quad on top of the glyph quad.

refs: #986
2021-07-30 19:23:02 -07:00
Wez Furlong
89586d658e dynamically allocate quads as needed
This removes the pre-allocated (at resize) number of quads
and replaces it with a dynamic mechanism that tracks how many
quads are needed for a frame and then will re-allocate and
re-render when there weren't enough.

We start with 1024 quads and try to allocate in multiples
of 1024 quads.

refs: #986
2021-07-30 16:59:47 -07:00
Wez Furlong
6a84f051b6 Make quad allocation more dynamic
This commit removes the `Quads` struct which maintained pre-defined quad
indices for each of the cells, the background image and scrollbar thumb.

In its place, we now "dynamically" hand out quads to meet the needs of
what is being rendered.  There are some efficiency gains here with
things like the selection (which can now be a single stretched quad,
rather than `n` quads in width).

This isn't a fully dynamic allocation scheme, as we still allocate the
current worst case number of quads when resizing.

A following commit will adjust that so that we allocate a ballpark and
then employ a mechanism similar to OutOfTextureSpace to grow and retry a
render pass when we need more quads.

Futhermore, this dynamic approach may allow reducing the amount of stuff
we have in the Vertex and "simply" render some quads before others so
that we don't have to have so many draw() passes to build up the
complete scene.

refs: #986
2021-07-30 12:59:15 -07:00
Wez Furlong
72d368440f move some of the vertex buffer state into TripleVertexBuffer
This is a stepping stone towards dynamically allocating
vertices.

refs: #986
2021-07-29 22:21:46 -07:00
Wez Furlong
71e88a4fea conceptually allow for multiple image attachments in a cell
refs: #986
2021-07-29 19:41:52 -07:00
Wez Furlong
7b0b042683 termwiz: parse and encode kitty image protocol
This teaches termwiz to recognize and encode the APC
sequences used by the kitty image protocol.

This doesn't include support for animations, just the
transmit, placement and delete requests.

refs: #986
2021-07-28 09:04:37 -07:00
Wez Furlong
a1f55049c5 deps: upgrade open 1.4 -> 2.0
The main difference is that it can now use `wslview` to open things
across wsl boundaries.

closes: #982
2021-07-26 08:15:02 -07:00
Wez Furlong
7192fe7696 respect reverse video attributes for inferred cells
In the case where the cells vec is shorter than the line width,
we need to ensure that we render the inverse video background
color if that mode is in effect.

refs: #133
2021-07-25 08:11:49 -07:00
Wez Furlong
51cc72e299 Schedule blink invalidations
Also fixes an issue where only the first frame schedule would
take effect!  Surprised this didn't bubble up as a bug with
animated gifs already.

refs: #133
2021-07-25 08:11:00 -07:00
Autumn Lamonte
e3f1d15f5d #133 unit tests 2021-07-24 23:43:30 -07:00
Autumn Lamonte
70544b7b26 #133 cleanup, rapid blinking text 2021-07-24 23:35:06 -07:00
Autumn Lamonte
d8cacee28a #133 blinking text 50% 2021-07-24 23:29:31 -07:00
Autumn Lamonte
d3b0881ded #133 Tab stops, reverse video. 2021-07-24 23:07:20 -07:00
Wez Furlong
6ddc8afc64 termwiz: recognize the XTGETTCAP DCS sequence
Parse and respond to this sequence docs can be found
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Device-Control-functions:DCS-plus-q-Pt-ST.F95

refs: https://github.com/wez/wezterm/issues/954
2021-07-24 21:06:48 -07:00
Wez Furlong
dcbbda7702 allow images to overlay text
This commit introduces a 4th draw pass for rendering sixel and
iterm images that are attached to cells.

Previously, a cell could container either text or an image from
the perspective of the renderer.  If it had an image then the glyph
bitmap would be ignored in favor of the image.

However, that causes sixel behavior to diverge from other terminals
(https://github.com/wez/wezterm/issues/942) so we need to be render
both of these.

The simplest way to achieve this is to add a distinct set of texture
coordinates for the attached image and then add a draw pass to alpha
blend it over the glyph content.

The sixel/iterm image processing stage is also adjusted to preserve
the prior cell information and "simply" attach the image info to
the cell.  Previously, the cell would be replaced with a blank cell
with the image attached.

The result of this is that the notcurses-demo intro section can
now render the orca "enveloped in the soft glow of glyphs" rather
than caged in a black box.

Note that there are some cases where the render turns blocky but
I suspect that that is due to some other misunderstanding between
wezterm and notcurses and that we'll root cause it as a follow up.
2021-07-22 09:46:08 -07:00
Wez Furlong
5434a2a581 wezterm-gui: fix over-invalidation when hovering hyperlinks
refs: #964
2021-07-21 08:58:35 -07:00
Cédric Schieli
77261ac374 Allow styling of the whole new tab button 2021-07-18 19:11:12 -07:00
Wez Furlong
a2e882a7cb deps: cargo update, and a couple of dependabot suggestions 2021-07-18 19:10:46 -07:00
Wez Furlong
7cd3dcaee4 tidy up cwd vs. home dir on Windows
Looking at #900; the unconditional directory change on startup
is "bad" because it only happens on Windows.

This commit removes it and instead puts the logic into the pty
layer to match the unix behavior.

The behavior is:

* If the command specifies the cwd, use that.
* Otherwise, use the home directory
2021-07-18 14:57:33 -07:00
Wez Furlong
a697b30223 window: add xsettings support on X11 systems
This allows reading xsettings which contain information about
both the active theme as well as the DPI.

refs: #947
2021-07-18 12:54:52 -07:00
Wez Furlong
1f5b900f3d plumb appearance change event -> reload on macos
This commit causes a window-config-reloaded event to trigger
when the appearance (dark/light mode) is changed on macos.

It also arranges to propagate the window level config to newly
spawned panes and tabs, created both via the gui and via the
CLI/mux interface.

refs: https://github.com/wez/wezterm/issues/894
refs: https://github.com/wez/wezterm/issues/806
2021-07-18 00:01:53 -07:00
Wez Furlong
75eaaab6a1 Allow window config overrides to apply per-pane
This allows window-level config overrides to apply
to panes contained within the window.

For instance, this allows setting a window-level
color scheme.
2021-07-17 23:02:41 -07:00
Wez Furlong
37888657bf fix rendering issue in close confirmation dialog
Mentioned in #898, the hover effect didn't match mouse movement.
This was just a rendering issue in the confirmation overlay.
2021-07-17 09:13:48 -07:00
Wez Furlong
020c0991e4 cleanup: remove term::Clipboard::get_contents method
This dates back to long ago, and is never called.
Remove it, and cleanup some state associated with it.
2021-07-17 07:38:48 -07:00
Wez Furlong
fcd5512709 fix misclassification of mouse events
While looking at https://github.com/wez/wezterm/issues/945 I noticed
that mouse moves were being considered to be drag events even though
no mouse buttons were held down.
2021-07-15 22:25:35 -07:00
Wez Furlong
ac5199c216 config: add bypass_mouse_reporting_modifiers option
This allows changing eg: SHIFT to ALT for bypassing mouse reporting.

refs: https://github.com/wez/wezterm/issues/911
2021-07-11 22:02:23 -07:00
Wez Furlong
be680955d7 scroll to bottom on paste
closes: https://github.com/wez/wezterm/issues/931
2021-07-10 22:04:43 -07:00
Wez Furlong
6aa575d838 fixup build on macos 2021-07-10 17:42:05 -07:00
Wez Furlong
db6da81272 window: move away from async event queue
I added this originally thinking that it would make it easier to resolve
https://github.com/wez/wezterm/issues/695 and to integrate wgpu support,
but it's the cause of https://github.com/wez/wezterm/issues/922 so let's
take it out and more directly connect the window events to those in the
terminal.

This commit likely breaks mac and windows; pushing it so that I can
check it out and verify on those systems.
2021-07-10 17:30:19 -07:00
Wez Furlong
47839adf95 CellAttribute: move fg/bg color accesses to accesors
This facilitates hiding the raw fields in the next diff
2021-07-10 15:15:36 -07:00
Wez Furlong
9c77d56026 RgbColor: hide internal red, green, blue fields
I'd like to adjust this to support 10bpc color, so the first step
is hiding the individual 8bpc fields.
2021-07-10 14:22:31 -07:00
Wez Furlong
313d130deb remove cluster from GlyphPosition
This simplifies the code and avoids a call to reverse the
cluster to the cell index.
2021-07-09 22:46:16 -07:00
Wez Furlong
2ed3cbe313 add per-line render latency histogram 2021-07-08 09:58:48 -07:00
Wez Furlong
7287447f33 refactor: hoist some params to higher render level
and pass down via params struct
2021-07-08 09:51:11 -07:00
Benoit de Chezelles
71ff0441c4 Rename cell_* to dot_area_* for clarity 2021-07-08 09:30:27 -07:00
Benoit de Chezelles
313365771d micro-opti: Pre-calculate bit masks for braille dots pattern 2021-07-08 09:30:27 -07:00
Benoit de Chezelles
249f9dfe29 Use squares instead of circles for braille dots (for simplicity & perf) 2021-07-08 09:30:27 -07:00
Benoit de Chezelles
d48cf4e5ee Few micro-optimizations for performance 2021-07-08 09:30:27 -07:00
Benoit de Chezelles
831f3a8b51 Make the braille dots smaller (and the code clearer!) 2021-07-08 09:30:27 -07:00
Benoit de Chezelles
3d9e791b84 glyph: Add working braille custom glyphs 2021-07-08 09:30:24 -07:00
Wez Furlong
381a17d897 capture some more latency measurements in histograms 2021-07-08 08:54:10 -07:00
Wez Furlong
e4b2a5c55a cache style-derived data in the line render loop
Just a simple cache to avoid repeated computation for space-separated
runs of clusters with the same attributes.
2021-07-08 08:36:54 -07:00
Wez Furlong
33309d95ac refactor: extract cached_cluster_shape from line renderer 2021-07-08 07:56:01 -07:00
Wez Furlong
2c1b532281 avoid lookup after shape cache miss 2021-07-08 07:48:13 -07:00
Wez Furlong
d32c6fca23 refactor: extract resolve_fg_color_attr to module scope 2021-07-08 07:46:21 -07:00
Wez Furlong
33c87611dc remove use of cluster cell idx in ls-fonts 2021-07-08 07:25:35 -07:00
Wez Furlong
b08a6ab5ef instrument cache hit rates, fix duration histograms 2021-07-07 17:21:18 -07:00
Wez Furlong
aac2e78970 update http_req -> 0.8
0.8 doesn't seem to build with rusttls, but I don't think
we need that any more: we've been using vendored openssl on windows
and mac for some time.

closes: #924
refs: https://github.com/jayjamesjay/http_req/issues/48
2021-07-07 13:37:57 -07:00
Benoit de Chezelles
a35aeca082 glyphs: Make heavy lines visibly heavy 2021-07-07 13:26:23 -07:00
Wez Furlong
1b77cb3491 ls-fonts: report config file errors
Previously, if the config file had errors, ls-fonts would silently
continue with the default config, which was confusing.

Make a point of checking and reporting config file errors.
2021-07-04 08:55:08 -07:00
Benoit de Chezelles
305c64c7ab Move glyphs previews LHS, add missing descriptions 2021-07-04 07:33:41 -07:00
Benoit de Chezelles
0d355e4d72 glyph: Comment the actual char for easy visualization 2021-07-04 07:33:41 -07:00
Wez Furlong
e05ddb1737 fix force_reverse_video_cursor 2021-06-28 09:18:13 -07:00
Wez Furlong
4f9532f9d8 window: plumb font config to underlying window impl 2021-06-26 22:58:42 -07:00
Wez Furlong
e69869efa7 refactor deps so that window can depend on wezterm-font
I want to use this to render the font in the title bar
2021-06-26 22:58:42 -07:00
Wez Furlong
8ab025b7fc Allow building without wayland support
You can run `cargo build --release --no-default-features` to build
without wayland support.

This is useful for systems that do not have wayland (eg: the `slint`
distro).
2021-06-26 22:58:42 -07:00
Wez Furlong
2fc143e6dd click to focus window now focuses the pane under the mouse cursor
refs: https://github.com/wez/wezterm/issues/881
2021-06-26 15:24:17 -07:00
Wez Furlong
e786968578 adjust hinting for box drawing
This looks better at more sizes

refs: #584
2021-06-26 13:56:16 -07:00
Wez Furlong
b7f504b15e complete box drawing glyphs
refs: #584
2021-06-26 13:45:45 -07:00
Wez Furlong
24fbba66c2 even more box drawing glyphs 2021-06-26 12:28:11 -07:00
Wez Furlong
29f28885fa box drawing: cell arcs 2021-06-26 10:37:09 -07:00
Wez Furlong
4e7f73fab7 box drawing: half lines and mixed lines 2021-06-26 10:16:12 -07:00
Wez Furlong
08fb4eb858 more dashes, and the diagonals 2021-06-26 09:55:45 -07:00
Wez Furlong
0b5444ccfd always use own box glyphs for pane splits
This section of the code wasn't looking up the custom glyphs
and would always use the font.  We can make rendering a little
more efficient if we skip the font resolution for this case,
and the code is much simpler if we just use our own box drawing
glyphs, so that's what we're doing here.

refs: #584
2021-06-26 09:26:10 -07:00
Wez Furlong
843dd88bb5 improve box drawing rendering at smaller font sizes 2021-06-26 08:54:01 -07:00
Wez Furlong
4c0d789ac3 zeno -> tiny_skia
Mostly so that we can turn off anti-aliasing for smaller sizes,
but it also happens to be more complete anyway.
2021-06-25 22:55:42 -07:00
Wez Furlong
fad09eddda even more box drawing glyphs 2021-06-25 21:56:24 -07:00
Wez Furlong
f846f0c9e8 missed the chonky 4 vertical dash 2021-06-25 10:04:49 -07:00
Wez Furlong
8a3fb11598 more box drawing glyphs 2021-06-25 09:58:51 -07:00
Wez Furlong
d7975b15c5 more box glyphs 2021-06-25 09:23:01 -07:00
Wez Furlong
afe63357d3 top left line box glyphs
refs: #584
2021-06-25 00:23:42 -07:00
Wez Furlong
e0ea161673 Custom glyphs for box drawings solid and dashed lines
closes: #588
refs: #584
2021-06-24 23:19:09 -07:00
Wez Furlong
1e8b9ec0bb block glyphs: adjust poly to allow per-path stroke/weight 2021-06-23 10:03:29 -07:00
Wez Furlong
8f676bda36 remove dead code 2021-06-23 09:48:36 -07:00
Wez Furlong
709f33561b ls-fonts: indicate when we're using a custom glyph
```
; ./target/debug/wezterm ls-fonts --text '├─░'
├    \u{251c}     glyph=915  wezterm.font("Terminus", weight="Bold", stretch="Normal", italic=false)
                             /home/wez/.fonts/terminus-bold.otb, FontDirs
─    \u{2500}     glyph=891  wezterm.font("Terminus", weight="Bold", stretch="Normal", italic=false)
                             /home/wez/.fonts/terminus-bold.otb, FontDirs
░    \u{2591}     drawn by wezterm: Full(Light)
```
2021-06-23 09:20:35 -07:00
Wez Furlong
ea95f3f735 don't round mouse coords when mouse is grabbed
refs: https://github.com/wez/wezterm/issues/898
2021-06-22 20:39:51 -07:00
Wez Furlong
9b6fa8d6af remove extraneous log::warn 2021-06-20 17:24:12 -07:00
Wez Furlong
ae4bfae5c4 mouse cursor -> Arrow when app grabs mouse
closes: https://github.com/wez/wezterm/issues/859
2021-06-19 17:35:16 -07:00
Wez Furlong
fdf871c3cb fonts: add wezterm ls-fonts --text "hello" to explain per-glyph font
```
; ./target/debug/wezterm ls-fonts --text "␉ ␌ ␍ ␊ ␋"
␉    \u{2409}     glyph=885  wezterm.font("Terminus", weight="Bold", stretch="Normal", italic=false)
                             /home/wez/.fonts/terminus-bold.otb, FontDirs
     \u{20}       glyph=2    wezterm.font("Operator Mono SSm Lig", weight="DemiLight", stretch="Normal", italic=false)
                             /home/wez/.fonts/OperatorMonoSSmLig-Medium.otf, FontDirs
␌    \u{240c}     glyph=888  wezterm.font("Terminus", weight="Bold", stretch="Normal", italic=false)
                             /home/wez/.fonts/terminus-bold.otb, FontDirs
     \u{20}       glyph=2    wezterm.font("Operator Mono SSm Lig", weight="DemiLight", stretch="Normal", italic=false)
                             /home/wez/.fonts/OperatorMonoSSmLig-Medium.otf, FontDirs
␍    \u{240d}     glyph=889  wezterm.font("Terminus", weight="Bold", stretch="Normal", italic=false)
                             /home/wez/.fonts/terminus-bold.otb, FontDirs
     \u{20}       glyph=2    wezterm.font("Operator Mono SSm Lig", weight="DemiLight", stretch="Normal", italic=false)
                             /home/wez/.fonts/OperatorMonoSSmLig-Medium.otf, FontDirs
␊    \u{240a}     glyph=886  wezterm.font("Terminus", weight="Bold", stretch="Normal", italic=false)
                             /home/wez/.fonts/terminus-bold.otb, FontDirs
     \u{20}       glyph=2    wezterm.font("Operator Mono SSm Lig", weight="DemiLight", stretch="Normal", italic=false)
                             /home/wez/.fonts/OperatorMonoSSmLig-Medium.otf, FontDirs
␋    \u{240b}     glyph=887  wezterm.font("Terminus", weight="Bold", stretch="Normal", italic=false)
                             /home/wez/.fonts/terminus-bold.otb, FontDirs
```
2021-06-19 16:55:45 -07:00
Wez Furlong
d57bc9b3dc CloseCurrentPane on last pane in a tab results in window closing
The issue is that the pane was only removed from the tab when explicitly
closed, leaving it to be later detected and flushed.

However, in the meantime, when performing eg: cursor blink maintenance,
if the set of panes in the tab is empty then the window would close.

The resolution is to ask the mux (rather than the tab) to kill the pane,
so that the cascading closure of the tab causes the window's active
tab to reference the correct remaining tab.

refs: #890
2021-06-19 11:06:14 -07:00
Wez Furlong
e0b62d07ca ls-fonts: add --list-system flag to list system fonts
heads up @bew!

This is implemented on windows and font-config systems;
needs to be fleshed out for macos.

refs: https://github.com/wez/wezterm/issues/347
2021-06-17 09:11:54 -07:00
Wez Furlong
1be3d016b1 deps: windows 0.9 -> 0.11
closes: #872
2021-06-16 08:29:09 -07:00
Wez Furlong
a4550385fc adjust zeno paths to allow for curves, add rounded powerline
refs: #584
2021-06-13 23:21:55 -07:00
Wez Furlong
1b3df56a91 custom powerline triangle glyphs
refs: #584
2021-06-13 22:04:42 -07:00
Wez Furlong
a217f96d6b Add some smooth mosaic custom glyphs
This proves the concept of using the zeno crate to draw filled
polygons.

refs: #584
refs: #588
2021-06-13 16:50:35 -07:00
Wez Furlong
6c702b568f glyphcache: adopt zeno crate for drawing
This changes the fill_rect function over to use the zeno crate.
zeno allows describing a path and filling or stroking.
This commit doesn't strictly need that, but it sets things
up for more interesting custom glyphs in later commits.

refs: #584
refs: #588
2021-06-13 15:49:37 -07:00
Wez Furlong
c036a7864b fix unused doc comment warning 2021-06-13 07:40:47 -07:00
nick black
5ca940c6d9 [sextants] fix copy-and-paste error on U+1FB06 2021-06-12 13:27:45 -07:00
Wez Furlong
ad0ee8f832 improve 1/8th block drawing
* Rename `draw_quad` to `fill_rect` to better indicate what it is doing.
* Switch the 1/8th block rendering to use `fill_rect` with math that is
  consistent with quad drawing to compute the bounds.

refs: https://github.com/dankamongmen/notcurses/issues/1715#issuecomment-860072690
2021-06-12 10:04:08 -07:00
Wez Furlong
2e7dc70eaf fixup tests 2021-06-10 20:40:57 -07:00
Wez Furlong
c7ec47e2c0 add sextant glyphs to custom block glyphs
While I'm in here, teach the font fallback code that it doesn't
need to search for these glyphs when custom block glyphs are
enabled.

refs: https://github.com/dankamongmen/notcurses/issues/1715
refs: #584
refs: #588
2021-06-10 20:38:48 -07:00
kas
4fcfb4b222 Use configured default program when running subcommand "start" with CWD option set and program unset
closes: https://github.com/wez/wezterm/pull/851
2021-06-10 07:11:40 -07:00
Wez Furlong
4feefdd04a cargo update 2021-06-07 08:32:05 -07:00
Roland Fredenhagen
e5806a6ac3 Better antialiasing for Undercurl 2021-05-31 16:33:20 -07:00
Wez Furlong
1a44255529 mux client: connect all mux panes in window to clipboard when attaching
refs: https://github.com/wez/wezterm/issues/836
2021-05-31 08:40:19 -07:00
Wez Furlong
b03e27adb1 deps: ordered-float 2.1 -> 2.5
closes: https://github.com/wez/wezterm/pull/831
2021-05-31 00:17:18 -07:00
Wez Furlong
5359f39dcf mux: fix an issue where auth window would linger before closing
Same vein as 8931afba5cee07ab12990f06c2ff34d6f8426b19; the auth
window could sometimes get stuck until an input event was sent
to it.

Wire up a mux event so that the window can close itself.
2021-05-31 00:11:47 -07:00
Wez Furlong
87cb593554 mux: client would prune out the empty window when connecting via ssh/tls domain
When the client connected to an empty remote mux, it would allocate an
empty window and then spawn a new tab into it.

Meanwhile, the authentication window would close and trigger a prune of
all empty windows, causing the in-flight spawn to fail because its
destination window was removed.

This commit defers window pruning while Activity is in progress;
the MuxWindowBuilder has an associated Activity count.
2021-05-30 23:50:13 -07:00
Wez Furlong
717a2157f6 fonts: synthesize dim when a light weight font is unavailable 2021-05-30 20:52:10 -07:00
Wez Furlong
cb4da18021 key assignment and docs for ShowDebugOverlay
refs: https://github.com/wez/wezterm/issues/641
2021-05-30 19:56:11 -07:00
Wez Furlong
f5f393bf2c term: notify embedding application when palette changes
refs: #748
2021-05-30 09:29:04 -07:00
Wez Furlong
d1e2108ce0 improve invalidations when resizing, adjusting viewport from overlay 2021-05-30 08:26:42 -07:00
Wez Furlong
8931afba5c fix more laggy invalidations
in the same vein as d657721163, the
increased idle loop means we need to be careful not to suppress
invalidation events.

In this case, overlays aren't from the window in the mux model,
so we'd ignore invalidations for those.

While looking at this I realized that we'd also do the same
for output being emitted in panes that were not the active pane,
so tidy that up.
2021-05-29 09:36:30 -07:00
Wez Furlong
257d323062 fixup laggy mux connections for recent idle changes
in the same vein as d657721163
this commit introduces more assertive signalling from the remote
mux when a pane is closed so that the client can update.
2021-05-29 00:16:27 -07:00
Wez Furlong
030e517b43 deps: metrics 0.15 -> 0.16, cargo update 2021-05-24 07:57:03 -07:00
Wez Furlong
930927fb69 gui: refactor: move resize method to resize module 2021-05-23 18:39:02 -07:00
Wez Furlong
f78190ec9c filedescriptor: remove anyhow from public interface
Use thiserror instead
2021-05-23 14:24:01 -07:00
Arvedui
dbc278e59a Fix spawning new tabs/windows in directory with urlunsafe paths
The CWD is internally stored as URL. The path component is therefore
stored percent_encoded. It must be decoded before use.
2021-05-18 08:33:06 -07:00
Wez Furlong
69561b96c8 fix wrong starting row for split paints when tab bar is at bottom
refs: https://github.com/wez/wezterm/issues/797
2021-05-15 07:47:33 -07:00
Wez Furlong
a59e9b1706 update metrics 0.14 -> 0.15
closes: https://github.com/wez/wezterm/pull/778
2021-05-11 19:20:24 -07:00
Wez Furlong
c2afe83d5d optimize resize event processing during live resize
This works by coalescing a sequence of resize/repaint events and
taking the most recent one.
2021-05-09 10:28:25 -07:00
Wez Furlong
e92e912443 refactor WindowEvent handling 2021-05-09 09:58:20 -07:00
Wez Furlong
b8acdf592f fix panic when double-click-selection drags across line boundary
closes: https://github.com/wez/wezterm/issues/762
2021-05-09 08:17:56 -07:00
Wez Furlong
f4e9668952 fix scaling of --> ligature in base font
refs: https://github.com/wez/wezterm/issues/699
2021-05-09 07:19:18 -07:00
Wez Furlong
4e6f341f10 window: wayland support is no longer optional at build time 2021-05-08 17:48:58 -07:00
Wez Furlong
fdce2d71d0 decompose period maintenance function
Split it into its component parts, and change the new dispatch
loop to sleep the appropriate interval only when needed.

refs: #770
2021-05-08 12:28:19 -07:00
Wez Furlong
b5bf25a9c5 remove check_for_dirty_lines_and_invalidate_selection from periodic
Since we now always check this during rendering, and we have a reliable
event for pane output, we don't need this check in the period task.

refs: #770
2021-05-08 11:32:12 -07:00
Wez Furlong
ed6987298a mux: remove window invalidation polling
Add a mux event for this insteead.

refs: https://github.com/wez/wezterm/issues/770
2021-05-08 11:25:03 -07:00
Wez Furlong
58157c47a9 config: can now subscribe to config change events
This removes a couple of periodic config polls

refs: https://github.com/wez/wezterm/issues/770
2021-05-08 11:06:07 -07:00
Wez Furlong
1cbaf55640 change mux empty poll to mux empty event
As part of reducing the amount of regularly scheduled stuff wezterm
does in the background, this commit restructures how an empty mux
is detected; now when the mux prunes dead windows it will emit
an Empty event.

The Activity type will now schedule a prune when it is dropped,
which will clean up and trigger the Empty event.

refs: https://github.com/wez/wezterm/issues/770
2021-05-08 10:25:49 -07:00
Wez Furlong
7cd9f32494 add some error context on notif dispatching
This was helpful when running down the situation in the previous
commit.
2021-05-08 10:21:44 -07:00
Wez Furlong
2e74663628 fixup log level for context loss 2021-05-08 09:36:19 -07:00
Wez Furlong
5d037eae52 adjust gui layer for window changes 2021-05-08 09:36:19 -07:00
Chris
2add312c5c
Allow VoidSymbol keycode to be seen by wezterm (#759)
* allow voidsymbol for key code

* update docs, cleanup

* cleanup and fmt of files

* remove unnecessary inputs
2021-05-07 07:54:24 -07:00