The compiled terminfo is reduced to a single artifact that CI checks
against its text source, failing on any drift.
Tests load the embedded entry and cover an XTGETTCAP response.
Other terminals do this when enabling focus tracking, and some programs
behave much better when they get it.
For instance, vim enables focus tracking when resumed after being
backgrounded, and then processes things on the focus event, such as
noticing if a file was changed.
Without this patch: saving a file in vim, Ctrl-Z, `cargo fmt --all`,
and `fg`; vim doesn't immediately notice the file was changed to reload it. (and then, you might edit the file further, and get a conflict later
when vim notices)
With this patch: vim notices the changes right away, making for a
smoother experience.
Add mouse and focus accessors to TerminalState so downstream programs
using wezterm-term crate can introspect the state and act in it.
---------
Co-authored-by: Mark Shamis <mark.shamis@gmail.com>
Co-authored-by: Benoit de Chezelles <benoit.dechezelles@gmail.com>
ImageDataType::Rgba8 carries the sha256 of its pixels, set wherever one
is built and refreshed wherever the pixels are mutated.
compute_hash always re-hashed the pixels to produce same stored hash.
Image hashing ran 3 times for every transmitted image:
- once in new_single_frame on image creation
- once for the cache key in raw_image_to_image_data
- once more in ImageData::with_data on the miss path
A 2400x1440 RGBA frame is 13.18MiB, so a client transmitting frames at
60fps spends most of its time budget there.
AnimRgba8 keeps hashing, because its stored hashes are per-frame, not
global, which compute_hash needs (all frames + their durations).
---------
Co-authored-by: Ido Samuelson <i-am-logger@users.noreply.github.com>
When a program turns on modifyOtherKeys and exits uncleanly, it can
leave ctrl keys emitting escape sequences the shell doesn't understand.
The obvious recovery is the "Reset the terminal emulation state in the
current pane" command in the command palette, which sends RIS. However,
RIS wasn't clearing modifyOtherKeys, so it didn't help. This commit
fixes RIS to reset that state, and a sweep for the same kind of
omission turned up missing resets for left/right margin mode and bidi
overrides, which it now resets too. This brings RIS in line with the
state a soft reset (DECSTR) already clears.
assign_image_to_cells contained two unguarded divisions that could panic
with 'attempt to divide by zero' and take down the pane (and, under the mux,
the pane's reader thread):
1. A Kitty graphics escape requesting a zero-sized placement (eg: an explicit
w=0/h=0, or a source origin outside the image bounds) yields a
draw_width/draw_height of 0, used as a divisor when sizing the image.
This is the case reported in #6344.
2. Displaying a cell-sized image (one without explicit c=/r=) on a pane whose
pty reported no pixel dimensions makes cell_pixel_width/height 0, which is
then used as a divisor. A zero pixel size is the default PtySize and is what
tmux/headless domains report, so a perfectly valid image crashes there.
Guard both: refuse the placement when the drawable region or the cell pixel
size is zero.
The error flows into the existing logging handlers for the Kitty, iTerm and
Sixel paths, so no callers change.
Real GUI panes always have a non-zero pixel size, so valid images are
unaffected.
Adds regression tests for both cases (each panics on main, passes with the
fix) and enables kitty graphics in the test terminal config (off by default)
so the path is exercised.
Closes#6344
---------
Co-authored-by: Benoit de Chezelles <benoit.dechezelles@gmail.com>
refs: https://github.com/wezterm/wezterm/issues/1422
refs: https://github.com/wezterm/wezterm/issues/6637
When we encounter a zero-width grapheme we need to be
a little bit smarter about how we handle it.
In the original implementation we'd unconditionally
remap these graphemes into a cell, effectively making
them appear as a blank cell with width of one.
Later we discovered that eg: BIDI control characters
should not be forced to display in this way, so the
logic was changed to elide these graphemes from the
model.
Subsequently we've found that the unicode line separator
should be treated as a blank. The unicode FAQ says
that any character that has the White_Space property
should be treated that way.
This commit applies that logic: if we get a zero-width
grapheme, if it is white space we'll force it to
have a width of 1, otherwise we'll elide it from
the model.
This probably is still not perfect, but hopefully
balances things out to be good enough, at least
until we find an example of where it isn't the right call!
This commit parses and captures the progress state as set by
ConEmu style progress reporting escape sequences.
Changes to the state will propagage through the mux via the
existing MuxNotification Alert system, and should also transit
across multiplexer connections. However, there is no separate
multiplexer state transfer for the progress state, so reconnecting
to a mux in the middle of a progress sequence will show as None
for the progress state, until the next update occurs.
Aside from propgating and exposing the state to lua via PaneInformation
and a Pane::get_progress method, wezterm doesn't do anything with
the progress information at this time.
This commit includes an example of how you might customize your
tab title to reflect the progress in the active pane.
refs: https://github.com/wezterm/wezterm/issues/6581
@tbung fixed a scrolling bug in #6099. This patch just
adds some tests and takes care of a couple corner cases
that still remained with region scrolling.
I never liked clippy for dropping turds like this throughout the
code. I'm glad it is no longer required, but now rust is warning
about this syntax being redundant.
wezterm ignores wrapped long line when alt screen is used and tmux uses
alt screen that makes copying wrapped long line into multiple lines.
After testing on sevaral tui apps like tmux, w3m, htop it seems to show
reasonable performance on resizing.
Fixes#5283
* Removed title update from main render loop
* Add to PaneFocused event
* term: only emit Alert::OutputSinceFocusLost for the first
seqno bump after losing focus, rather than on every bump.
That event indirectly causes the title to update
refs: https://github.com/wez/wezterm/issues/4788
The concept of uninitialized cells in wezterm is not the same as that on
VT520 or that on xterm, so treat them as spaces, at least when asking
for the checksum of a single cell, which is what esctest does.
Given a sequence like this, where the `ESC [ K` sequence is
emitted at the last column when wrap_next=true:
\u001b[47;30m 17:24:50 \u001b[0m\u001b[K
rather than treating the column as out of bounds, we'd clear the
final cell.
refs: #3548
The server-side ownership of the palette is a stumbling block for
many users, so let's fix it.
This commit allows the client to pass its configured palette to
the server when it connects, and when the config is changed.
That palette takes precedence over the palette from the server config.
However, if the remote application uses any escape sequences that
redefine the color palette, the color palette that was active at
that point in time is forked and use as the basis, and will remain
the active palette until the palette is reset via escape sequences.
refs: https://github.com/wez/wezterm/issues/2686
refs: https://github.com/wez/wezterm/issues/3397