1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-20 11:17:15 +03:00
Commit Graph

330 Commits

Author SHA1 Message Date
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
70544b7b26 #133 cleanup, rapid blinking text 2021-07-24 23:35:06 -07:00
Autumn Lamonte
c19f330194 #133 parse out double-width/double-height, but do not render 2021-07-24 23:20:06 -07:00
Autumn Lamonte
d2e2c5dec6 #133 clean up DECREQTPARM 2021-07-24 23:19:51 -07:00
Autumn Lamonte
ad30664361 #133 Screen.reverse_video_mode + fmt fixes 2021-07-24 23:13:40 -07:00
Autumn Lamonte
31aff81884 #133 DECREQTPARM - needs cleanup 2021-07-24 23:10:52 -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
365a68dfb8 Wrap up synchronized output handling, parser changes
This commit hooks up DECRQM so that we can report that we implement
synchronized updates, and then refines the code that manages sending
data to the terminal model; the first cut at synchronized updates
was a bit simplistic, and now we make a point of "flushing" pending
actions when we start a sync point, and again as soon as we release
the sync point.

This smooths out the jaggies around the orca that I mentioned in
dcbbda7702

and while testing this, I realized that recent parser changes had
mangled processing bundled dec private mode sequences where multiple
modes were specified in the same overall escape sequence.  I've
added the missing unit test case for this and made that work again.

refs: https://github.com/wez/wezterm/issues/955
refs: https://github.com/wez/wezterm/issues/882
2021-07-24 17:01:21 -07:00
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