1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 02:25:28 +03:00
Commit Graph

320 Commits

Author SHA1 Message Date
Wez Furlong
a249021920 vtparse: simplify csi dispatch
This commit removes the intermediates parameter and collapses it
together with the parameters themselves.

This allows us to model DECSET (eg: `CSI ? 1 l`) correctly.
Previously this would get reported as:

```
  params: [1],
  intermediates: ['?'],
  code: 'l'
```

but since the intermediates are logically things that precede the code,
the canonical interpretation of that would be as if we'd received
`CSI 1 ? l`.

AFAICT, DECSET isn't conforming to ECMA 48 when it comes to this
sequence.

That made things a bit of a headache in the CSI parser, so what we do
now is to treat intermediates as parameters so that it is much simpler
to reason about and match in the CSI parser; we now get:

```
  params: ['?', 1],
  code: 'l',
```

refs: https://github.com/wez/wezterm/issues/955
2021-07-24 12:44:49 -07:00
Wez Furlong
86c1d50b4a WIP: improve CSI parsing fidelity
The original design of the vtparse crate was inspired by the vte
crate.  There were some assumptions about the shape of CSI sequences
that were lossy and that is posing a problem when it comes to
implementing DECRQM.

This commit improves the situation by adjusting CsiParam to be capable
of capturing all of the possible parameters as well as intermediates.

This commit isn't done; I just need to push it to transfer it to another
machine.

refs: https://github.com/wez/wezterm/issues/882
refs: https://github.com/wez/wezterm/issues/955
2021-07-24 08:34:36 -07:00
Wez Furlong
c6dc677e50 preliminary support for synchronized output
This implementation doesn't include a timeout, but should be
recoverable via a SoftReset.

There's no query response either: I think I'm missing DECRQM
entirely at the moment.

refs: https://github.com/wez/wezterm/issues/882
2021-07-24 08:34:36 -07:00
Wez Furlong
092effba04 fix background color cloning
4e99edf6f5 split the color into
thin/fat components, but overlooked copying the optional fat
part of the color.

That in turn broke sequences like:

* Set background color
* Erase to end of line

This commit teaches the sgr attribute cloning function to look
at the optional fat component.

refs: #962
2021-07-21 07:56:36 -07:00
Wez Furlong
a2e882a7cb deps: cargo update, and a couple of dependabot suggestions 2021-07-18 19:10:46 -07:00
nick black
9355da958a implement DA3 tertiary deviceattr
Add the third device attributes (DA3) query+reply,
eliminating "unknown/unspecified CSI" error. Like
XTerm, simply reply with zeroes as opposed to site
codes or unique IDs.
https://vt100.net/docs/vt510-rm/DA3.html
2021-07-17 20:47:41 -07:00
nick black
d337677b8e
[terminfo] add smxx/rmxx, purge blink (#905)
* [terminfo] add smxx/rmxx, purge blink

Testing with WezTerm nightly indicates no blink support
available through the xterm \E[5m, and I didn't see any
support in the code -- purge it. smxx and rmxx, meanwhile,
have been added to indicate support for struck text.

* restore blink

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2021-07-11 21:36:56 -07:00
Wez Furlong
cc2b9507f8 fixup build on windows 2021-07-10 17:52:14 -07:00
Wez Furlong
4e99edf6f5 CellAttributes: split color into thin/fat components
The common palette indices are in the main cell attributes.
Using true color will allocate fat storage.

This allows reducing the Cell size from 32 -> 24 across the
implementation of storing 10 bpc color (it peaked at 40 in
the last couple of commits).
2021-07-10 15:42:15 -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
1a673a5e5b RgbColor: store 10bpc
This makes Cell larger; will compensate in following diff
2021-07-10 15:06:32 -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
Autumn Lamonte
39535bbd77 #891 Fix tests 2021-06-20 08:29:31 -07:00
Autumn Lamonte
ab1cad0cbf #891 VT100 character set support 2021-06-20 08:29:31 -07:00
Wez Furlong
ccd66c01a9 sixel: respect Dec Private Mode 8452
This adjusts the cursor position after emitting a sixel.

@dankamongmen: I don't have much of a sixel test suite to speak
of (cat snake.six :-p); I'd appreciate it if you could run
notcurses against this and confirm that it is doing something
sane!

At the very least, we shouldn't be warning about the unhandled
mode any more!

refs: https://github.com/wez/wezterm/issues/863
refs: https://github.com/dankamongmen/notcurses/issues/1743
2021-06-19 21:07:44 -07:00
Wez Furlong
d317f0f312 Don't abort for overlay large sixel payloads
Rust hasn't stabilized fallible allocation, so when we are presented
with an implausibly large sixel, Rust terminates the program; it's not
even a panick that we could potentially catch -> direct to termination.

This commit introduces an arbitrary constraint so that we can
avoid unconditionally terminating for this bad input case.

Thanks to @klamonte for sharing this test case!
2021-06-19 13:01:17 -07:00
Wez Furlong
8ca0024bfb termwiz: erase_cell could panic if erasing beyond EOL
A relatively recent commit made it possible for the cell storage
to be smaller than the viewport width.

Avoid panicking when erasing beyond the end of the cell storage.
We can simply NOP as that cell is already implictly erased.

closes: #847
2021-06-16 08:35:09 -07:00
Wez Furlong
d1d7def1a1 termwiz: avoid file io when terminfo db is pre-filled
ProbeHints would unconditionally load the terminfo based on $TERM
whever it was created, even if the caller had a pre-supplied
terminfo buffer.

Defer loading that until the caps instance is created.

refs: #817
2021-06-13 09:06:22 -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
f78190ec9c filedescriptor: remove anyhow from public interface
Use thiserror instead
2021-05-23 14:24:01 -07:00
Wez Furlong
a8f7359322 wezterm.terminfo: update to use newer mouse protocol by default
refs: https://github.com/wez/wezterm/issues/789
2021-05-15 19:15:26 -07:00
Wez Furlong
d246ef4cdc cargo fmt 2021-05-11 19:19:55 -07:00
Wez Furlong
3d83a805ec add support for the true color escapes that don't specify colorspace
refs: https://github.com/wez/wezterm/issues/785
2021-05-11 17:24:26 -07:00
Wez Furlong
f9a6e265e9 avoid panics in a couple of cases
test case: `cat /dev/random`

refs: https://github.com/wez/wezterm/issues/769
2021-05-08 01:02:44 -07:00
Wez Furlong
ff153ba27f vtparse: recognize utf8 encoded c1 codes in more cases
There were two bugs here:

* \u8D (the utf8 encoded representation of 0x8d, aka: RI) was not
  recognized as a C1 code and was instead passed through as printable
  text.
* The \u8D is a zero-width sequence which means that a subsequent
  set_cell call on the new empty-by-default line wouldn't allocate
  any cells in the line array, and the assigment to the line would
  panic.

This commit avoids the panic for the second case, and then fixes up
the vtparser to correctly recognize the sequence as a C1 control.

refs: https://github.com/wez/wezterm/issues/768
2021-05-08 00:39:29 -07:00
Wez Furlong
6d7f9879ac be more aggressive at pruning trailing blanks 2021-04-29 16:00:33 -07:00
Wez Furlong
f91ca30008 micro-optimize clustering
This improves it by ~4x for long lines, taking it from 120us to ~30us.
2021-04-28 08:25:07 -07:00
Wez Furlong
b0f5e673c6 vtparse/termwiz: prep for release 2021-04-14 13:04:23 -07:00
Wez Furlong
0ed94a4218 don't panic when double clicking space at the end of a wrapped line 2021-04-10 17:27:04 -07:00
Jun Wu
228eab546e termwiz: do not use terminfo for unsupported 256-colors
I noticed edenscm log -p (using streampager) cannot render 256 colors
if TERM is not "*-256color", despite forcing enabling true colors in
streampager (https://github.com/markbt/streampager/pull/28).

I tracked it down here. The problem is that we ask terminfo for colors
it does not claim to support. Fix it by using fallback CSI rendering
for colors exceeding the terminfo max color.
2021-04-09 08:04:55 -07:00
Wez Furlong
3dfdd08b79 parse and respond to XTSMGRAPHICS queries
refs: https://github.com/wez/wezterm/issues/609
2021-04-01 22:42:28 -07:00
Wez Furlong
d827be990d speculatively apply hyperlinks to logical lines
This might be all that is needed to make multiline implicit hyperlinks
function, but I need to transfer this commit to another machine to try
it.

refs: https://github.com/wez/wezterm/issues/527
refs: https://github.com/wez/wezterm/issues/408
2021-03-26 13:47:27 -07:00
Wez Furlong
dc4676047e stronger invalidation when resizing
This seems to make it very difficult to reproduce the blanked
out regions in the related issue.

refs: https://github.com/wez/wezterm/issues/574
2021-03-25 15:16:50 -07:00
Wez Furlong
2902a76c5c lint: fix some clippy stuff 2021-03-25 10:05:34 -07:00
Wez Furlong
3bec6fb5c0 lint: remove redundant semicolons
Newer versions of Rust emit warnings for these
2021-03-25 09:44:27 -07:00
Wez Furlong
868a085157 termwiz: shrink-to-fit Line::cells when clearing the line
refs: https://github.com/wez/wezterm/issues/534
2021-03-13 08:25:09 -08:00
Wez Furlong
f4105cb42f avoid excess capacity when dealing with iterm2 image protocol
Using a boxed slice means that we hold exactly the memory required
for the file data, rather than the next-power-of-two, which can
be wasteful when a large number of images are being sent to
the terminal.

This is a API breaking change for termwiz, so bump its version.

refs: #534
2021-03-13 08:10:48 -08:00
Mark Juggurnauth-Thomas
60c0d91a07 termwiz: use cnorm instead of cvvis for CursorVisibility::Visible 2021-03-12 08:20:01 -08:00
Mark Juggurnauth-Thomas
ee03d9a260 termwiz: revert tmux workarounds
We can support tmux by properly supporting the distinction between
`cvvis` and `cnorm`.
2021-03-12 08:20:01 -08:00
Wez Furlong
77011593b7 termwiz: alternate plan for restoring cursor visibility in tmux
backout 7c49b43472 and go with
the alternate plan of switching TERM=tmux if `$TERM==screen && $TMUX`.

refs: https://github.com/markbt/streampager/issues/37#issuecomment-797274512
2021-03-11 23:23:32 -08:00
Wez Furlong
7c49b43472 termwiz: improve restoring cursor visibility under tmux
refs: <https://github.com/markbt/streampager/issues/37#issuecomment-797241725>
2021-03-11 22:23:53 -08:00
Wez Furlong
565a4c69d5 lua: add wezterm.format function
The intent is to use this to compose text for a configurable tab bar.

refs: https://github.com/wez/wezterm/issues/500
2021-03-02 09:52:54 -08:00
Wez Furlong
60be1a98a0 lua: add window::effective_config() method
Expose the current window configuration to lua scripts.

refs: https://github.com/wez/wezterm/issues/469
2021-02-27 12:39:22 -08:00
Wez Furlong
f0c163e212 Plumb OSC 777 to toast notifications
```
echo -e "\033]777;notify;This is the notification title;This is the notification text\a"
```

Now pops up a notification in a similar manner to OSC 9, except
that this form allows setting both the title and the body separately.

refs: https://github.com/wez/wezterm/issues/489
2021-02-18 22:13:20 -08:00
Wez Furlong
578b59ad33 fix one 32-bit build issue
refs: #474
2021-02-12 08:35:00 -08:00
Wez Furlong
005b492a8b deps: update to ordered-float 2.1 2021-02-07 22:54:02 -08:00
Wez Furlong
b60e83b22b docs: start documenting supporting escape sequences
I started this a while ago; it's pretty time consuming to produce
accessible and usable documentation for this sort of stuff, so
this isn't yet complete, but in the interest of avoiding additional
bit-rot, let's get this up.

refs: https://github.com/wez/wezterm/issues/257
2021-01-18 11:16:18 -08:00
Wez Furlong
ce6ecc1f38 termwiz: really fixup windows build 2021-01-08 09:33:08 -08:00
Wez Furlong
3a9ab729db termwiz: fixup win32 build 2021-01-08 08:55:43 -08:00
Wez Furlong
5d360ae365 termwiz: Remove anyhow::Result from public API
It's been replaced with an opaque termwiz error type instead.

This is a bit of a more conservative approach than that in (refs: #407)
and has less of an impact on the surrounding code, which appeals to
me from a maintenance perspective.

refs: #406
refs: #407
2021-01-08 00:32:30 -08:00