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

4038 Commits

Author SHA1 Message Date
Wez Furlong
a0da69f56b cargo update 2021-08-01 18:40:25 -07:00
Wez Furlong
1f49147560 kitty img: prune unreferenced images when RAM utilization is high
This adds a simple garbage collection scheme; when adding an image,
check to see if we're over budget on the total amount of RAM used
by the image data.

If we are, remove unreferenced images (images that are not placed)
until we're below the budget.

refs: #986
2021-08-01 15:43:48 -07:00
Wez Furlong
4d5d5a7516 kitty img: fix deletion by image_id with no placement_id
refs: #986
2021-08-01 15:12:29 -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
25f4308e4f docs: changelog for #532
closes: https://github.com/wez/wezterm/issues/532
2021-08-01 13:58:27 -07:00
Wez Furlong
ecc63e2e5d wayland: improve mouse cursor resolution and diagnostics
Switch to using `xterm` rather than `text` for the name of the
xterm style I-beam mouse cursor, as that appears to be more
compatible across themes; the gnome theme aliases text -> xterm
via a symlink.

Improve error diagnostics in the case that no cursor is found.

refs: https://github.com/wez/wezterm/issues/532
2021-08-01 13:47:24 -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
267885ce0b workaround a guillotiere issue
We don't need to free any allocations, so we can use the simple
allocator instead and avoid the issue.

refs: https://github.com/nical/guillotiere/issues/25
2021-08-01 00:12:19 -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
ff3ba4c4ec parse and respond to kitty img protocol queries
refs: #986
refs: https://github.com/dankamongmen/notcurses/issues/1998
2021-07-31 17:32:40 -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
fb9338f0e7 default disable kitty graphics until support is improved
You can run `wezterm --config enable_kitty_graphics=true` to do ad-hoc
tests with the protocol enabled.

refs: #986
refs: #1998
2021-07-31 10:23:44 -07:00
Wez Furlong
159abe5e28 mux: make action parser buffer size configurable and smaller
Previously, we'd use a 1MB buffer both to read the output from the
associated pty (blocking), and the same size buffer again to do the
non-blocking read on top of that.

For pathological cases (eg: cat 100MB+ files), we could build a
resulting `Vec<Action>` with over 1mm entries and it could take as much
as 100ms to apply those actions to the terminal model.

This meant that the output could stutter/lag and appear to be processed
more slowly.

This commit introduces a configuration value for the buffer size for the
second stage, and makes it 10KB in size.  This helps to constrain the
size of the Action vec and keeps the incremental processing costs down,
while still managing the same throughput.
2021-07-31 08:57:13 -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
38e350e9c8 ErrorKind::Unsupported is rust 1.53 and up
This isn't a hard requirement, but tracking 1.53 doesn't
feel like a burden as 1.54 is now the stable rust version.
2021-07-29 19:50:22 -07:00
Wez Furlong
c867b4e079 window: fix warning when buildings tests on !macos 2021-07-29 19:44:34 -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
96f15a065c kitty img: add deflate support
Untested... it compiles!

refs: #986
2021-07-28 09:29:40 -07:00
Wez Furlong
62cc64f293 incomplete, basic implementation of kitty image protocol
This isn't complete; many of the placement options are not supported,
and the status reporting is missing in a number of cases, including
querying/probing, and shared memory objects are not supported yet.

However, this commit is sufficient to allow the kitty-png.py script
(that was copied from
https://sw.kovidgoyal.net/kitty/graphics-protocol/#a-minimal-example)
to render a PNG in the terminal.

This implementation routes the basic image display via the same
code that we use for iterm2 and sixel protocols, but it isn't
sufficient to support the rest of the placement options allowed
by the spec.

Notably, we'll need to add the concept of image placements to
the data model maintained by the terminal state and find a way
to efficiently manage placements both by id and by a viewport
range.

The renderer will need to manage separate quads for placements
and order them by z-index, and adjust the render phases so that
images can appear in the correct plane.

refs: #986
2021-07-28 09:04:52 -07:00
Wez Furlong
f0996a5dc5 termwiz: add KittyImageData::load_data
refs: #986
2021-07-28 09:04:45 -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
de1298f8b2 vtparse: parse APC sequences
These were parsed but swallowed. This commit expands the transitions
to be able to track the APC start, data and end and then adds
an `apc_dispatch` method to allow capturing APC sequences.

APC sequences are used in the kitty image protocol.

refs: #986
2021-07-28 09:04:28 -07:00
Wez Furlong
227e375a5f deps: cargo update 2021-07-26 08:16:03 -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
1c366063a3 take another crack at fixing up line wrapping attributes
This time we set the wrapped attribute when we implicitly emit
a newline and the wrap_next flag is set.

refs: #978
refs: #971
2021-07-25 09:47:29 -07:00
Wez Furlong
6345caccb0 docs: fix table 2021-07-25 09:16:55 -07:00
Wez Furlong
6ef039a726 docs: changelog and more info on custom block glyphs
closes: #584
2021-07-25 09:11:39 -07:00
Wez Furlong
1be7665c14 docs: changelog and brief docs for synchronized rendering
closes: #882
2021-07-25 08:52:12 -07:00
Wez Furlong
613bc5a4f1 docs: fix some broken links/typos 2021-07-25 08:46:10 -07:00
Wez Furlong
50c3e171c6 docs: text_blink_rate
refs: #904
2021-07-25 08:43:03 -07:00
Wez Furlong
b95317241c docs: fix missing pane parameter in format-window-title-event
closes: #974
2021-07-25 08:32:50 -07:00
Wez Furlong
17a9b60e63 docs: update information about blink, which is now rendered 2021-07-25 08:28:22 -07:00
Wez Furlong
bd7a2a6692 docs: changelog for #904
closes: #904
refs: #133
2021-07-25 08:25:20 -07:00
Wez Furlong
aca13c6977 termwiz: fixup regression in sgr parsing for empty parameter case
I broke this with my recent csi parser changes.
2021-07-25 08:20:36 -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
d100dded23 #133 cleanup + terminalstate-level reverse video mode 2021-07-24 23:36:49 -07:00
Autumn Lamonte
ce9d166733 #133 ENQ response 2021-07-24 23:36:20 -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