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

629 Commits

Author SHA1 Message Date
Wez Furlong
aa94a98314
fix invalidation on palette change
refs: https://github.com/wez/wezterm/issues/4932
and possibly: https://github.com/wez/wezterm/issues/2635
2024-02-01 15:58:14 -07:00
Wez Furlong
86d9ec69f5
term: downgrade conpty tmux title mangling warning to debug
The user can't do anything about it anyway.
2024-01-31 07:36:30 -07:00
jonboh
820c451b57 add small helper function to better express bool casting 2024-01-28 07:59:13 -07:00
jonboh
500f84617e fix kitty image protocol display parameters 2024-01-28 07:59:13 -07:00
Wez Furlong
7f3a835548
fix excessive calls to format-tab-title
* 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
2024-01-25 23:14:38 -07:00
Wez Furlong
516add5a4b
fixup tests for seqno increment on resize change
refs: https://github.com/wez/wezterm/issues/4828
refs: https://github.com/wez/wezterm/issues/3694
refs: https://github.com/wez/wezterm/issues/2351
2024-01-23 18:31:59 -07:00
Wez Furlong
8f74e1c848
increment seqno when resizing
Without this, we don't invalidate the shape hash eg: when zooming a
pane.  This is potentially also the root cause of some other weirdness
with the multiplexer.

refs: https://github.com/wez/wezterm/issues/4828
refs: https://github.com/wez/wezterm/issues/3694
refs: https://github.com/wez/wezterm/issues/2351
2024-01-23 18:08:46 -07:00
Wez Furlong
ba85958a61
deps: update env-logger
Note that we are pinned on 0.10 for env-bootstrap, where we use it
only for its module filter parser.
2024-01-20 16:01:10 -07:00
Wez Furlong
9fc89e621f
de-fang paste payloads by removing bracketed paste sequences from them
refs: https://github.com/wez/wezterm/issues/4765
2024-01-08 18:17:22 -07:00
Luis Javier Merino Morán
97e001c93c Clamp cursor position reported by CPR
From esctest:
CHATests.test_CHA_OutOfBoundsLarge
CUPTests.test_CUP_OutOfBoundsParams
HVPTests.test_HVP_OutOfBoundsParams
2023-11-22 14:56:26 -07:00
Luis Javier Merino Morán
769840d2cb DECRQCRA: treat uninitialized cells as spaces
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.
2023-11-22 14:38:11 -07:00
Luis Javier Merino Morán
c4654d8bf4 Make RIS also clear the alternate screen
xterm clears the alternate screen on RIS since #383. VTE and konsole
already did that.

From esctest:
RISTests.test_RIS_ExitAltScreen
2023-11-12 17:09:34 -07:00
Luis Javier Merino Morán
f880188ae4 Default G1 to ASCII
As per DEC STD-070 3.6.4

refs: https://github.com/wez/wezterm/issues/3962
2023-11-07 08:22:51 -07:00
Wez Furlong
c75f20f21c
deps: ordered-float -> 4.1.0
closes: https://github.com/wez/wezterm/pull/4338
2023-09-28 14:39:22 -07:00
Sean Sullivan
5161de59fe expose pen attribute on terminal info 2023-09-22 12:21:15 -07:00
Wez Furlong
33e727b074
Respond to DECRQM 2027 - grapheme clustering
closes: https://github.com/wez/wezterm/issues/4320
2023-09-20 14:48:05 -07:00
Wez Furlong
c1b7ba2f35
fix warning in latest rust compiler 2023-08-28 06:39:14 -07:00
Wez Furlong
b7771feef6
imgcat: work better with tmux and conpty
Neither of these understand image protocols, and both are
an additional processing layer between the application and
wezterm.

This commit detects and wraps OSC sequences in tmux's passthru
sequence so that the data is passed on to wezterm rather than
elided from the data stream.

For image protocols in both tmux and conpty, work a little
smarter and explicitly move the cursor position to the same
location that wezterm would move it to.  That prevents the
display from being as mangled by tmux/conpty due to a diverging
understanding of the cursor position.

The logic isn't perfect, and can result in the x-coordinate
being incorrect, and this won't work with the new --position
argument either in its current state, without adding a lot
of complexity to deal with scrolling and relative and absolute
positioning handling.

To facilitate that, a new termwiz Terminal trait method has
been added to probe the terminal name, version, cell and pixel
dimensions. It's not pretty.

refs: https://github.com/wez/wezterm/issues/3624
refs: https://github.com/wez/wezterm/issues/3716
2023-07-15 22:13:19 -07:00
Rémi Labeyrie
da2c035ad2 feat: handle horizontal mousewheel events 2023-07-10 12:55:13 -07:00
Wez Furlong
c54548df7e
Fix ClearToEndOfLine in last column when wrap_next=true
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
2023-05-29 16:01:11 -07:00
Wez Furlong
e0a4ebd586
implicitly reset palette when setting it to the equivalent of the config
refs: #3685
2023-05-29 14:46:43 -07:00
Wez Furlong
74da631430
mux: allow client to provide palette to mux server
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
2023-03-31 08:02:32 -07:00
Wez Furlong
c1366b217d
term: respect log_unknown_escape_sequences for OSC 2023-03-29 05:28:28 -07:00
Jalil David Salamé Messina
407b1297eb fix: Update snapshot (see commit 31100244) 2023-03-27 07:38:55 -07:00
Wez Furlong
59503034c7
tidy up some debug logging 2023-03-25 20:33:23 -07:00
Wez Furlong
727cd95dcd
images: improve logging when things are weird
refs: https://github.com/wez/wezterm/issues/3366
2023-03-25 18:55:26 -07:00
Wez Furlong
2e488d57c7
update terminfo to 0.8 2023-03-24 10:12:49 -07:00
Wez Furlong
bc7acc18e0
fixup images with the multiplexer
* Translate from File to EncodedFile as needed
* Adopt blob leases in the mux server
* Fix an issue where the first image sent by the mux server would
  be replaced on the client by its background image, if configured.
  Removed the ImageData::id field to resolve this: you should use
  the hash field instead to identify and disambiguate images.
  Bumped the termwiz API version because this is conceptually
  a breaking change to the API

refs: https://github.com/wez/wezterm/issues/3343
2023-03-23 21:43:28 -07:00
Wez Furlong
897237cc97
fix: disable mouse reporting for RIS/ResetTerminal sequence 2023-03-23 12:01:24 -07:00
Wez Furlong
287026cfa0
rustfmt 2023-03-22 20:05:25 -07:00
Wez Furlong
dc36fe18f4
term: adjust logical line wrapping behavior
Really, this is adjusting the logical line breaking behavior, or the
lack thereof.

The situation is this: conpty can decided to reinterpret and flush
large sections of its buffer as a continuous stream of unbroken
characters with no breaks when it repaints the full screen.

When we receive such an update, we see it as one long logical line,
and when we subsequently select multiple lines we can run into the
maximum logical line length and insert invalid synthetic line breaks
into the data that we send to the clipboard.

This commit adjusts the wrapping logic at the time that we receive
the text so that we don't tag the line as a logical line continuation
if:

* The alt screen is active. Full screen apps will re-render on resize
  anyway, and we don't reflow long lines on resize either for the same
  reasons

* If we are talking to ConPTY:
     * If the last character in the line is not alphanumeric or
       punctuation (in other words: it doesn't look plausibly like
       text that should be a line continuation).

refs: #3278
refs: #3177
2023-03-22 19:13:26 -07:00
Jalil David Salamé Messina
d541e2e13d fix(clippy): Remove closures where possible
- Removes closures and function calls for types that implement default:

  ```rust
  // Change
  let _my_str = get_str().unwrap_or(String::new);
  // To
  let _my_str = get_str().unwrap_or_default();
  ```

- Uses the `.cloned()/.copied()` methods where possible
- Use function pointer instead of simple closure

May improve performace, as closures generate more code, and this might
unlock some inlining opportunities.
2023-03-19 08:41:38 -07:00
Jalil David Salamé Messina
191aacc7d7 fix(clippy): Use faster methods on Iterators
- Use `find` instead of `position(..).next()`
- Use `any` instead of `position(..).next().is_some()/.is_none()`
- Use `first/next` instead of `get(0)/nth(0)`
- Prefer `for` loops over `while let` loops on iterators

May improve performance.
2023-03-19 07:29:23 -07:00
Wez Furlong
7cd0cc21bf
ImageDataType::File -> EncodedLease
Adopt the new blob lease layer to storing and referencing
image files.

This reduces the number of open files needed when
images are being displayed in the terminal.

refs: https://github.com/wez/wezterm/issues/3263
2023-03-18 20:32:49 -07:00
Wez Furlong
2d255c2d75
fix kitty image protocol handling
Input data:

\e_Ga=T,f=32,s=10,v=22,c=1,r=1,m=1\e\\e_Gm=1;/xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T//P=\e\\e_Gm=1;/xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T////E////xP///8T//P=\e\\e_Gm=0\e\

There were two issues in handling this:

* We expected there to be `;payload` in the first transmission packet,
  but there wasn't one, so we ignored it as ill-formed.
* The standard base64 decoder in the rust ecosystem is super strict
  and rejects the "sloppy" python base64 encoder output that isn't
  strictly conformant with the RFC.  We need to jump through some
  hoops to get it to relax and accept the input.

refs: https://github.com/wez/wezterm/issues/2716
2023-03-17 15:39:01 -07:00
Wez Furlong
e090eb9eae
Image decoding is now done in a bg thread
Continuing from the previous commit, this shifts:

* In-memory data -> temporary file
* Image decoding -> background thread

The background thread asynchronously decodes frames and
sends them to the render thread via a bounded channel.

While decoding frames, it writes them, uncompressed, to
a scratch file so that when the animation loops, it is
a very cheap operation to rewind and pull that data
from the file, without having to burn CPU to re-decode
the data from the start.

Memory usage is bounded to 4 uncompressed frames while
decoding, then 3 uncompressed frames (triple buffered)
while looping over the rest.

However, disk usage is N uncompressed frames.

refs: https://github.com/wez/wezterm/issues/3263
2023-03-17 11:41:20 -07:00
Wez Furlong
aa929a1a9b
move animation decoding from term layer to gui layer
This makes decoding animation frames a lazy operation, but it
comes at the cost of needing to re-decode the image from scratch
when it loops, because the image crate doesn't provide a way
to rewind its frame iterator.

That initial decode can have a significant time cost; a small
webp file consistently takes 150ms to decode, which is too
much to do inline in the render thread.

Next steps will be to move that cost off the render thread.
2023-03-17 11:41:20 -07:00
Wez Furlong
587ceca98e
term: avoid breaking animated webp images when resizing
refs: https://github.com/wez/wezterm/issues/3258
2023-03-16 22:55:38 -07:00
Wez Furlong
97452d0ccc
term: improve readability of error message for oversized image
refs: https://github.com/wez/wezterm/issues/3264
2023-03-16 22:41:52 -07:00
Wez Furlong
a115fc0df7
fix iterm2 image cursor position
refs: https://github.com/wez/wezterm/issues/3266
2023-03-16 21:53:13 -07:00
Jalil David Salamé Messina
cb9dc3a800 fix(clippy): Remove unnecessary clone/to_string calls 2023-03-16 07:40:12 -07:00
Wez Furlong
5e5f816f83
add log_unknown_escape_sequences config option 2023-03-15 22:47:32 -07:00
Wez Furlong
2bfb29f1be
improve handling of animated webp images
Use mainline image crate to avoid an otherwise unavoidable panic
in the upstream: https://github.com/image-rs/image/issues/1775

Explicitly operate on the frames from the animation.

refs: https://github.com/wez/wezterm/issues/3250
2023-03-15 11:34:47 -07:00
Wez Furlong
3509e210ce
termwiz: bump version ready for publish 2023-02-12 06:57:31 -07:00
Wez Furlong
9dc76b852b
lua: add some more tab methods 2023-01-20 20:02:29 -07:00
Wez Furlong
15cd1afbdc
lua: add some pane methods for working with zones
refs: https://github.com/wez/wezterm/issues/2968
2023-01-18 19:38:51 -07:00
Wez Furlong
6e06b9af02
mux: Pane is now required to be Send+Sync. Use Arc<dyn Pane> 2022-12-19 11:52:33 -07:00
Wez Furlong
e70f97903b
disable window title reporting escape sequence by default 2022-12-18 10:37:21 -07:00
Wez Furlong
9923ae20b5
env_logger -> 0.10
closes: https://github.com/wez/wezterm/pull/2803
2022-11-27 21:37:25 -07:00
Wez Furlong
274b1819a1
Fix horizontal wheel events
refs: https://github.com/wez/wezterm/issues/2649
2022-11-13 08:58:35 -07:00