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

322 Commits

Author SHA1 Message Date
Wez Furlong
7767fbe88f termwiz: fixup tests after b3f51e8ee2 2020-10-11 17:21:16 -07:00
Wez Furlong
2a87c1dec7 Change cell api to avoid direct access to hyperlink/image
This allows potentially changing the struct layout
to reduce the struct size.
2020-10-11 13:12:46 -07:00
Wez Furlong
99df89eaa1 fix cargo doctest warning 2020-10-03 11:15:57 -07:00
Wez Furlong
6430952d74 cargo update 2020-09-09 09:31:37 -07:00
Wez Furlong
38277a9592 term: when setting both icon and window title, clear icon title
Clear the icon title and just set the window title processing
that event.

refs: https://github.com/wez/wezterm/issues/247
2020-08-12 22:37:46 -07:00
Wez Furlong
bb1e355b7d term: get_title prefers icon title over window title
When returning the title string we prefer to return the OSC 1 Icon
title (which is interpreted as "tab title" by some emulators and
shell toolkits) on the basis that it will have been setup for
display in a more limited width than the overall window title
and will thus likely be a better choice to show to the user.

If OSC 1 hasn't been set then we'll fall back to the OSC 2 window
title as before.

refs: https://github.com/wez/wezterm/issues/247
2020-08-12 22:34:41 -07:00
Wez Furlong
dd57f05774 Treat OSC 0 and OSC 1 the same as OSC 2: set the title
OSC 1 is defined as setting the "Icon Title".
OSC 2 is defined as setting the "Window Title".
OSC 0 sets both of those.

Some terminal emulators will display the Icon title as the tab
title.

Wezterm doesn't make a distinction between any of those things; the
title is applied (during escape sequence parsing) to the terminal
instance in isolation from any other terminals; when the GUI layer
renders the titlebar it is composed from the title in the active tab.

refs: https://github.com/wez/wezterm/issues/247
2020-08-02 22:52:04 -07:00
Wez Furlong
a9ee544d7c term: use BufWriter for writer
I'm wondering if the non-deterministic portion of
refs: https://github.com/wez/wezterm/issues/241
might be due to splitting of data across multiple write calls.

This commit adopts the use of BufWriter around the writer so that
we can buffer up and explicitly flush the responses to the terminal.
2020-07-12 09:08:39 -07:00
Wez Furlong
b307df6add term+termwiz: handle OSC L and OSC l
These are equivalent to OSC 2 and OSC 1 respectively.

We now also respond to requests to fetch the window title
2020-06-21 10:46:03 -07:00
Wez Furlong
badc4f9d9c term+termwiz: add Overline support
This commit teaches the terminal model about the overline attribute
and the SGR codes to enable/disable overline.

The render layer in the GUI doesn't yet understand this attribute.
2020-06-20 22:48:36 -07:00
Wez Furlong
4e6357b218 term: enable DECSET 1004 Focus Reporting
This is enabled only for local terminals for now; the multiplexer
protocol will need to be extended to carry this signal.
2020-06-20 22:01:56 -07:00
Wez Furlong
59ca0da7ad term: fix representation of unmodified F5+
We were unconditionally adding the encoded form of the modifier
mask (eg: appending `;1~` to the sequence) and not all apps know
how to interpret that.

refs: https://github.com/wez/wezterm/issues/227
2020-06-20 12:11:35 -07:00
Wez Furlong
fded650ccb term: add DECRQSS DECSLRM response
While testing this with esctest, it was apparent that xterm deviates
from the DEC docs by allowing a minimum region size smaller than 2,
so adjust our restriction accordingly.
2020-06-20 11:12:18 -07:00
Wez Furlong
b69c9b1c70 termwiz+term: add basic support for DECRQSS
Now that we're reporting a higher level from DA1, apps are asking
more exotic codes.  eg: vttest now asks about the conformance level,
but doesn't have a timeout on that request and hangs if we don't
respond.

This commit adds a bit of plumbing to make it easier to consume
and parse DCS sequences that are known to be short/short-lived,
and teaches the term layer to respond to a couple of possible
DECRQSS queries.
2020-06-20 11:04:37 -07:00
Wez Furlong
aa106b33f1 termwiz: improve Debug impl for EnterDeviceControlMode 2020-06-20 09:51:25 -07:00
Wez Furlong
e2dc0add83 termwiz: recognize CSI > PP ; Pv m sequence
This is an xterm sequence that adjusts how the terminal
encodes keyboard output.

This commit teaches termwiz to parse and encode the sequence,
but doesn't teach the terminal emulator to do anything with it
at this time.

I'm adding this because vim sends these sequences and I wanted
to understand what they were for.
2020-06-19 23:40:48 -07:00
Wez Furlong
35a3f802c2 termwiz+term: improved emulation conformance in a number of areas
This commit adds support for left/right margins and has been
tested against esctest, with a final status of:

```
309 tests passed, 239 known bugs
```

"known bugs" also includes unimplemented features; we have a
similar degree as iTerm2.

As of this commit, we now report as a vt520ish machine to DA1.
I confess to not having read enough of the relevant docs
to know whether this is totally righteous.
2020-06-19 21:20:05 -07:00
Wez Furlong
efe425c4f6 term: s/scroll_region/top_and_bottom_margins/ 2020-06-18 15:41:54 -07:00
Wez Furlong
bd3844d665 term: improve CUU conformance, pass CUU esctests 2020-06-18 07:45:33 -07:00
Wez Furlong
99108afa60 term: improve CUD conformance and pass CUD esctest 2020-06-18 07:19:49 -07:00
Wez Furlong
22f6ec0070 term: implement CBT and pass CBT esctests 2020-06-18 05:50:28 -07:00
Wez Furlong
1288819180 term: improve esctest BS test conformance 2020-06-18 05:43:47 -07:00
Wez Furlong
b6e9fb07d4 term: improve esctest ANSIRCTests conformance
These tweaks to cursor save/restore enable wezterm to pass my wezterm
enabled local branch of esctest.
2020-06-17 23:09:37 -07:00
Wez Furlong
5c5bef934b add decset 1047; our impl is the same as decset 47 2020-06-17 21:44:11 -07:00
Wez Furlong
8f1f1a65ea window: handle opengl context loss on windows.
With this commit, we now survive a reinstall or upgrade of the nvidia
drivers on my Windows sytem without crashing.

This commit allows notifying the application of the context loss
so the application can either try to reinit opengl or open a new
window as a replacement and init opengl there.

I've not had success at reinitializing opengl after a driver upgrade;
it seems to be persistently stuck in a state where it fails to allocate
a vertex buffer.

SO, the state we have now is that we try to reinit opengl on a new
window, and if that fails, leave it set to the software renderer.

This isn't a perfect UX, but it is better than terminating!

refs: https://github.com/wez/wezterm/issues/156
2020-06-16 21:17:48 -07:00
Wez Furlong
fad6e8cbc1 term: fix an off-by-one in clear-to-start-of-line
refs: https://github.com/wez/wezterm/issues/218
2020-06-14 10:31:49 -07:00
Wez Furlong
39f4985741 maybe fixup windows build for num/num_traits changes 2020-06-13 12:05:47 -07:00
Wez Furlong
24fdf27d65 misc: upgrade unicode-segmentation 2020-06-13 10:10:34 -07:00
Wez Furlong
2f3a508e99 term: make serde optional 2020-06-13 10:04:20 -07:00
Wez Furlong
3002b40fd2 termwiz: make serde an optional dep
closes: https://github.com/wez/wezterm/pull/186
2020-06-13 09:55:18 -07:00
Wez Furlong
d547d938d8 term: rename crate to wezterm-term in advance of publishing
Add some more docs and remove a couple of dead bits of code.
2020-06-13 09:55:16 -07:00
Wez Furlong
47dc81c8d9 termwiz: separate CursorVisibility from CursorShape
They are separate concepts and this simplifies some processing.

closes: https://github.com/wez/wezterm/pull/212
2020-06-12 19:44:54 -07:00
Wez Furlong
7c8b69e5a0 term: improve sgr mouse button up response
Rather than reporting the basic mouse reporting "button released"
event code, in SGR mouse mode we can report that actual mouse
button that was released.  So do it.

refs: https://github.com/wez/wezterm/issues/211#issuecomment-642877545
2020-06-11 20:48:10 -07:00
Wez Furlong
87eedfd42d wezterm: add dec private mode 1070 for sixel color map control
refs: https://github.com/wez/wezterm/issues/217
2020-06-11 19:03:12 -07:00
Wez Furlong
d5927c22fa term: expand scope of Primary DA response
We now claim to be vt320ish with support for selective erase and sixel
graphics.

refs: https://github.com/wez/wezterm/issues/217
2020-06-11 08:13:42 -07:00
Wez Furlong
a78954375d wezterm: sixel rendering basically working
refs: https://github.com/wez/wezterm/issues/217
2020-06-11 08:13:37 -07:00
Wez Furlong
108def1f90 termwiz: add types for sixel parsing
refs: https://github.com/wez/wezterm/issues/217
2020-06-11 08:13:29 -07:00
Wez Furlong
9f1303fb8e term: fixup ctrl+ ambiguous ctrl code representation
This was originally intended to be swept in and dealt with as part of
adopting CSI-u (refs: https://github.com/wez/wezterm/issues/63) but the
default shift-space mapping is super irritating in vim (refs:
https://github.com/wez/wezterm/issues/126) so it got partially walked
back, but as a consequence we accidentally dropped the modifiers from
those keys (refs: https://github.com/wez/wezterm/issues/213 refs:
https://github.com/wez/wezterm/issues/214).

This commit restores the modifiers for that case.

In addition, since we now have a way to plumb configuration directly
into the term crate, this adds a config option to enable CSI-u for those
that want to use it.
2020-06-10 17:07:30 -07:00
Wez Furlong
afe0475ced term: improve support for AnyEvent and non-SGR mouse reporting
refs: https://github.com/wez/wezterm/issues/211
2020-06-10 12:00:14 -07:00
Wez Furlong
9c9933039d term: implement RIS Full Reset sequence
refs: https://github.com/wez/wezterm/issues/211#issuecomment-642056005
2020-06-10 08:38:04 -07:00
Wez Furlong
ff9151bb9b termwiz/term: implement window/pixel size responses
refs: https://github.com/wez/wezterm/issues/211
2020-06-08 18:44:05 -07:00
Wez Furlong
fd512da983 term: improve iterm2 image pixel->cell calculation
If the image is smaller than the cell size we could end up
rounding that dimension to zero and ultimately not render
the texture to the cell.

This commit adjusts the math to round up, which yields
better results for the test in refs: https://github.com/wez/wezterm/issues/211
2020-06-08 18:02:51 -07:00
Wez Furlong
42e2775f36 wezterm: more fun with SS3 vs CSI and cursor key encoding
I noticed that we still weren't quite right.
I think the net change is really just that we must force
the use of the CSI representation when using CTRL/SHIFT
modifiers.

refs: https://github.com/wez/wezterm/issues/203
2020-06-01 18:59:18 -07:00
Wez Furlong
ccf9fc141b wezterm: fixup DECKPAM/DECANM/DECCKM interaction
We were treating DECCKM as the sole thing to enable application
cursor reporting, but looking closely at the docs, that mode only
takes effect when both DECANM (Vt52 emulation mode) AND DECKPAM
(application keypad mode) are both active.

neovim enables DECCKM and DECKPAM but not DECANM.

refs: https://github.com/wez/wezterm/issues/203
2020-05-31 15:45:25 -07:00
Wez Furlong
cb3606d130 term: remove TerminalHost from api
This simplifies a bunch of things
2020-05-30 07:53:50 -07:00
Wez Furlong
b8acbac113 wezterm: add ClearScrollback key assignment
Bound to CMD-K and CTRL+SHIFT-K by default.  This also functions
while the output is filling up (eg: `find /` and hit the key binding
to keep pruning the scrollback).

closes: https://github.com/wez/wezterm/issues/194
2020-05-25 17:29:22 -07:00
Wez Furlong
33e387be7d term: implement EraseInDisplay::EraseScrollback
refs: https://github.com/wez/wezterm/issues/194
2020-05-25 17:13:08 -07:00
Wez Furlong
b67682ddc9 wezterm: move most click related mouse events to InputMap
The click/movement related events are now "table driven" with
defaults contained in the InputMap object.

This gives the the potential to be configured from the config
file, but there is not glue in the config layer to enable
this yet.

This also does not include mouse wheel events.
2020-05-21 18:51:20 -07:00
Wez Furlong
b00f383f2b Suppress logging about CSI 8 Y ; X t
neovim will try to force the window to resize after suspend/resume.
No other terminal allows this today, so rather than log it as an
unhandled event, explicitly ignore it.
2020-05-16 09:56:43 -07:00
Wez Furlong
a3921a73fa Explicitly ignore focus tracking (dec private mode 1004)
We still don't support it, but we no longer log that we don't
know what the mode is.
2020-05-16 09:31:02 -07:00