1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-21 03:39:16 +03:00
Commit Graph

542 Commits

Author SHA1 Message Date
Wez Furlong
80214319ae adjust log levels
Revise logging so that we use info level for things that we want
to always log, and adjust the logger config to always log info
level messages.

That means shifting some warning level logs down lower to debug level so
that they aren't noisy.

closes: https://github.com/wez/wezterm/issues/388
2020-12-20 22:01:06 -08:00
Aaron Abramov
2eef556092
Update snapshot tests to use k9@0.10.0 (#384)
I'm gradually improving snapshot testing macro devx in k9 and preparing
to ship v1. Before i do this i'm changing the inline snapshot macro to be
just `snapshot!()` that takes `Debug` trait an an arg and figures out
serialization of it.
2020-12-19 16:43:25 -08:00
Wez Furlong
8eb0dac92c Update lru -> 0.6 2020-12-09 14:04:56 -08:00
Wez Furlong
dfde0c8809 term: revise color cube in the default palette
This commit adjusts the default color palette to use the same color
cube calculation as xterm; it isn't the ideal color cube calculation
and results in slightly brighter colors.

This commit also memoizes the default palette calculation so that
it isn't recomputed each time a palette is created.

refs: https://github.com/wez/wezterm/issues/348
2020-12-09 00:52:24 -08:00
Wez Furlong
eabfa3c0f8 term: fix ALT-Escape
This appears to have been accidentally broken as part of the churn
around building out CSI-u key encoding in
6289c08a4e

closes: https://github.com/wez/wezterm/issues/338
2020-11-23 14:20:43 -08:00
Wez Furlong
a063d20cf0 wezterm: improve shaping of emoji
This is one of those massive time sinks that I almost regret...
As part of recent changes to dust-off the allsorts shaper, I noticed
that the harfbuzz shaper wasn't shaping as well as the allsorts one.

This commit:

* Adds emoji-test.txt, a text file you can `cat` to see how well
  the emoji are shaped and rendered.

* Fixes (or at least, improves) the column width calculation for
  combining sequences such as "deaf man" which was previously calculated
  at 3 cells in width when it should have just been 2 cells wide, which
  resulted in a weird "prismatic" effect during rendering where the
  glyph would be rendered with an extra RHS portion of the glyph across
  3 cells.

* Improved/simplified the clustering logic used to compute fallbacks.
  Previously we could end up with some wonky/disjoint sequence of
  undefined glyphs which wouldn't be successfully resolved from a
  fallback font.  We now make a better effort to consolidate runs of
  undefined glyphs for fallback.

* For sequences such as "woman with veil: dark skin tone" that occupy a
  single cell, the shaper may return 3 clusters with 3 glyphs in the
  case that the font doesn't fully support this grapheme.  At render
  time we'd just take the last glyph from that sequence and render it,
  resulting in eg: a female symbol in this particular case.  It is
  generally a bit more useful to show the first glyph in the sequence
  (eg: person with veil) rather than the gender or skin tone, so the
  renderer now checks for this kind of overlapping sequence and renders
  only the first glyph from the sequence.
2020-11-23 13:45:38 -08:00
Wez Furlong
0b64683a60 term: allow embedding application to hook device control mode
refs: https://github.com/wez/wezterm/issues/336
2020-11-20 09:24:48 -08:00
Wez Furlong
fd3c062daf cargo fmt
latest rust changed the formatting options, so reformat to
avoid the CI being unhappy.
2020-11-20 09:06:21 -08:00
Wez Furlong
37a3f7db5f wezterm: add ScrollToPrompt key assignment
Adds some supporting methods for computing the `SemanticZone`s
in the display and a key assignment that allows scrolling the
viewport to jump to the next/prev Prompt zone.
2020-11-08 09:58:02 -08:00
Wez Furlong
3d0107cb75 term/termwiz: add Cell::semantic_type
This commit allows the terminal to tag cells with their semantic
type, as defined by OSC 133 escape sequences.

The gist of it is that each cell is now semantically one of:

* Output (eg: from the activity performed by the user. This is the
  default)
* Input (eg: something that the user typed as input)
* Prompt (eg: "uninteresting" chrome/UI from the shell)

The semantic type is applied almost exactly like an SGR attribute,
except that resetting SGR doesn't clear the semantic type.

Tagging the cells in this way allows for smarter UX in the future;
for example, selecting the entire input or output from the last
command without fiddling around to avoid the prompt line(s),
or "paging up" to a prior prompt rather than page.

This doc covers those escapes as used in domterm, iterm2 and other
terminals:
https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md

This is an example of how to configure the shell to emit these
sequences; I'll add a proper little blob of shell specifically
for wezterm in a later commit:
https://github.com/PerBothner/DomTerm/blob/master/tools/shell-integration.zsh
2020-11-07 11:54:22 -08:00
Wez Furlong
d896fa02b0 termwiz: add OSC 133 Semantic Marker sequences
These are proposed in a spec here:
https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md

but are also used by iTerm2 in its shell integration here:
https://iterm2.com/documentation-shell-integration.html

This commit just teaches termwiz how to encode/decode the
OSC sequences.
2020-11-07 11:54:22 -08:00
Wez Furlong
cfef4fd0ca wezterm: adjust pixel width and height when dragging splits
The drag would update the cell dimensions but not the pixel dimensions,
which results in weird image scaling.

refs: #312
2020-11-02 19:56:46 -08:00
Wez Furlong
7fb22d6968 term: correct cursor position after imgcat
I've had a FIXME in here for a while to check the positioning,
but never got around to it.

The onefetch folks have an app that does care about this,
so it's time to resolve it!

This commit adjusts the cursor position for the iterm case
(not the sixel case), and results in both:

running in xterm:

```
onefetch --image ~/Downloads/squirrel.png
```

running in wezterm:

```
TERM_PROGRAM=iTerm.app onefetch --image ~/Downloads/squirrel.png --image-backend=iterm
```

```
onefetch --image ~/Downloads/squirrel.png --image-backend=sixel
```

showing consistent positioning.

refs: https://github.com/wez/wezterm/issues/317
refs: https://github.com/o2sh/onefetch/pull/305
2020-11-02 18:06:05 -08:00
Wez Furlong
9614e117e0 term: restore original resize behavior on Windows
This reverts to the original resize behavior of padding out
the display when resizing taller, but only for Windows systems.

More explanation in the comments in the code.

refs: #138
2020-10-31 11:58:15 -07:00
Wez Furlong
75ce0fc822 term: improve cursor/viewport positioning on resize
This seems to make our resize behavior a bit nicer and more
consistent with eg: xterm.

Previously we'd consider the previously existing scrollback
as immutable and prefer to add excess blank lines of padding
when making the window taller.

In practice that meant that content would scroll back when
making the window taller, which is annoying.

This commit removes that constraint and instead will prefer
to maintain the cursor position relative to the top of the
viewport when the size changes.

refs: #138
2020-10-28 22:50:50 -07:00
Wez Furlong
5b9c86d836 colors: set cursor border to bg in the color schemes
This avoids having a green (by default) border around the cursor.
The dynamic color escape sequences have been updated to also
change the border color when the cursor background color is changed.
2020-10-27 09:17:20 -07:00
Wez Furlong
dab2dd5025 term: cache recently decoded images
This commit introduces a small, bounded, LRU cache for recently
decoded images.

This allows the same image ID to be used in the cache that the
same image bits are repeatedly sent to the terminal.

This is advantageous because it reduces the amount of texture
space required by the gui layer.
2020-10-25 11:59:44 -07:00
Wez Furlong
e2bf111426 wezterm: fix texture coordinates math for image protocols
There was an integer conversion happening when taking the
per-cell image texture coordinates and applying them to the
texture atlas image coordinates.

This commit replaces that math with floating point and corrects
the visual artifacts within squirrel.png.

refs: #292
2020-10-24 11:13:08 -07:00
Wez Furlong
91ce0b77ea wezterm: tidy up shader a bit
More properly annotate the types of the data used in the shaders.
Make the declarations more consistent with each other.
2020-10-24 10:42:23 -07:00
Wez Furlong
1978eba0a1 wezterm: make the split color configurable and darker
This makes the color of the split divider darker by default,
and configurable via the color scheme configuration file.

refs: #297
2020-10-19 22:05:13 -07:00
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
Wez Furlong
a1c0cabf18 term: process OSC 110+: ResetDynamicColors
neovim uses these
2020-05-16 09:25:17 -07:00
Wez Furlong
132529cfd5 support Terminal identification sequence
This reports the TERM_PROGRAM and TERM_PROGRAM_VERSION
separated by a space.

See discussion in https://github.com/mintty/mintty/issues/881
with a more concise description of the functionality here in
this VTE issue: https://gitlab.gnome.org/GNOME/vte/-/issues/235

```bash
$ printf '\033[>q'; cat
^[P>|WezTerm 20200503-171512-b13ef15f-4-g0395639a^[\
```
2020-05-03 22:10:38 -07:00
Wez Furlong
ea401e1f58 term: add implicit SGR reset when switching alt screen
This was a bit of a pain to track down because this behavior
isn't specified anywhere or called out explicitly.

The issue is that if you use a true color escape sequence such as

```bash
printf "\x1b[38;2;255;100;0mTRUECOLOR\n"
```

the active color would remain active when switching between the
primary and the alt screen until something (eg: `ls --color`) changed
it again.

I hadn't run into this because in my prompt, many many years ago, I had
it set to perform an SGR reset (`\x1b[0m`) as the first thing to ensure
that the shell is in a saner state.

For users that don't do this they end up with a weird looking color
bleed effect.

refs: https://github.com/wez/wezterm/issues/169
2020-04-18 19:26:54 -07:00
Wez Furlong
5b700e4d5d wezterm: recognize MS terminal mode 25 for cursor visibility 2020-04-06 13:19:44 -07:00
Wez Furlong
54cc62ccf9 ctrl-space should send NUL 2020-03-28 18:32:20 -07:00
Wez Furlong
013288b1ef mux: grey out the terminal contents when tardy
The predictive echo feels pretty reasonable, but if the connection
is having problems and we're showing the tardiness indicator, the
echo can give the impression that your input is going to get processed.
That may not be (usually is not!) the case.

This commit makes it a bit more visually distinctive that something
isn't right by greying out the color palette in that case.

refs: https://github.com/wez/wezterm/issues/127
2020-03-14 08:57:35 -07:00
Wez Furlong
50caecfd9d fixup term tests for set_title cleanup 2020-01-26 10:02:07 -08:00
Wez Furlong
f41d82a254 remove some dead TerminalHost code 2020-01-26 08:55:56 -08:00
Wez Furlong
ee70ec3ae0 Add support for OSC 104 (ResetColors) 2020-01-26 08:26:01 -08:00
Wez Furlong
f125bd863a remove dead click_link method from terminal host
This is now handled by the gui layer
2020-01-25 23:17:45 -08:00
Wez Furlong
6ddf9ec3dd default dec auto wrap mode to on 2020-01-25 22:28:45 -08:00
Wez Furlong
1bb39835c0 vttest: respect dec auto wrap mode
refs: https://github.com/wez/wezterm/issues/133
2020-01-25 20:49:39 -08:00
Wez Furlong
2de60e3791 vttest: handle dec origin mode
This makes us pass the cursor positioning tests
(with the exception of the 132 column mode)

refs: https://github.com/wez/wezterm/issues/133
2020-01-25 20:35:33 -08:00
Wez Furlong
9d63d30fc0 vttest: make the E's show up on the cursor positioning test
Refs: https://github.com/wez/wezterm/issues/133
2020-01-25 20:20:31 -08:00
Wez Furlong
e45bace9eb shift-space now emits space
This isn't a 100% righteous fix, but is sufficient to reduce
the irritation in refs: https://github.com/wez/wezterm/issues/126

The full fix is pending another round of review of the CSI-u stuff
in refs: https://github.com/wez/wezterm/issues/63
2020-01-23 23:29:42 -08:00
Wez Furlong
4b455288dd track the full current dir URL for OSC 7
Matching against the current dir when it includes a host and a
path seems like a handy way to automate selecting appropriate
theme/color/profile settings, so I'd like to make sure that
we have the full URL content available for that.

Refs: https://github.com/wez/wezterm/issues/115
Refs: https://github.com/wez/wezterm/issues/117
2020-01-14 22:06:13 -08:00
Wez Furlong
41162f4361 fixup tests for the previous change
(also makes it easier to debug test failures without RUST_BACKTRACE=1)
2020-01-12 11:40:42 -08:00
Wez Furlong
e1f1f9cbd6 improve cursor positioning after a resize
The rewrap logic makes dealing with the cursor position a bit
more complex and we had a problem where resizing the window shorter
and then taller would allow the shell to cursor up into the scrollback
when displaying its prompt, and allow it to overwrite something that
was logically in the scrollback.
2020-01-12 10:15:53 -08:00
Jeremy Fitzhardinge
71eb27ccb5 Add get_current_working_dir to Tab 2020-01-11 18:25:17 -08:00
Jeremy Fitzhardinge
b53412d0cb Track current working dir via OSC 2020-01-11 18:25:17 -08:00
Wez Furlong
2e581252c1 refine vertical size adjustments when resizing the terminal 2020-01-11 09:40:36 -08:00
Wez Furlong
d91e384a7e improve cursor position adjustment on resize
Avoids accidentally moving the y position of the cursor; previously
we would keep it pinned to the physical viewport relative coordinate,
but we didn't account for the implicit scroll that happens when
making the window smaller, which meant that the shell would re-render
its prompt with some artifacts during a resize.
2020-01-11 08:44:28 -08:00
Wez Furlong
e13b4f7dc9 remove dead code
This logic has all moved to the render layer
2020-01-11 08:34:01 -08:00
Wez Furlong
afbd262740 rewrap: tweak how we consider row count 2020-01-11 08:08:42 -08:00
Wez Furlong
e6b4aa835a re-wrap lines when resizing
Adds logic to resize handling that will consider the original logical
line length when the width of the terminal is changed.

The intent is that this will cause the text to be re-flowed as if it had
been printed into the terminal at the new width.  Lines that were
wrapped due to hittin the margin will be un-wrapped and made into a
single logical line, and then split into chunks of the new width.

This can cause new lines to be generated in the scrollback when
making the terminal narrower.  To avoid losing the top of the buffer
in that case, the rewrapping logic will prune blank lines off the
bottom.

This is a pretty simplistic brute force algorithm: each of the lines
will be visited and split, and for large scrollback buffers this could
be relatively costly with a busy live resize.  We don't have much choice
in the current implementation.

refs: https://github.com/wez/wezterm/issues/14
2020-01-11 00:10:25 -08:00
Wez Furlong
4765ce60e5 mux: avoid overly aggressively dirtying lines
Still not perfect; there's a window invalidation missing from
the mux somewhere on higher latency connections that gets
resolved just by moving the mouse :-/
2020-01-09 06:39:00 -08:00
Wez Furlong
4687b3bb48 clippy 2020-01-05 15:14:32 -08:00
Wez Furlong
89f2023577 mux: invalidate StableRowIndex 0..rows when switching alt screen
We would leave a copy of the alt screen lines at the top of the
scrollback.

This commit ensures that those lines are marked dirty and that
the dirty bits are propagated to the client to invalidate its cache.
2020-01-05 15:07:00 -08:00
Wez Furlong
55e4050aa3 use LastMouseClick for paste click counting 2020-01-05 14:37:17 -08:00
Wez Furlong
6183434bda Track viewport in the gui layer
Use StableRowIndex to implement tracking the viewport in the gui layer.
This resolves an issue where a busy terminal would continue to scroll
through the scrollback when you were paging backwards and look weird.

There's still some cleanup though:

- This breaks the selection ui
- the cursor position is wrong when scrolling back
- shift-pageup/pagedown need to be processed in the gui layer

Refs: https://github.com/wez/wezterm/issues/106
2020-01-05 14:37:17 -08:00
Wez Furlong
1b3ced2ab3 Add StableRowIndex concept
This will make it easier to manage both the viewport and the
selection in the gui layer.

refs: https://github.com/wez/wezterm/issues/106
2020-01-05 14:37:17 -08:00
Wez Furlong
a0ad0d0c34 terminalstate: remove middle click paste handling
This is safely performed 100% by the gui layer now.
2020-01-05 14:37:17 -08:00
Wez Furlong
5ba0c70cdb add Tab::is_mouse_grabbed concept
refs: https://github.com/wez/wezterm/issues/106
2020-01-05 14:37:17 -08:00
Wez Furlong
f0e94084d1 change backspace/delete handling
Previously we would try to pass through the Backspace and Delete
code points without interference, but that behavior wasn't quite
right.

With this commit our behavior is now:

- At the window layer: Classify a `Backspace` key press as logically
  `BS` and a `Delete` key press as logically `DEL` unless the
  `swap_backspace_and_delete` is true (macOS is true by default), in
  which case `Backspace` is mapped to `Delete` and vice versa.

- At the terminal input layer: A `Backspace` input from the Window sends
  the `DEL` sequence to the pty as that matches the default `VERASE` stty
  configuration.  A `Delete` input from the Window emits `\033[3~`,
  which matches up to the `TERMINFO` for `xterm-256color` which we
  claim to be compatible with, and is our default `$TERM` value.

The net result of this is that `Backspace` will now start to emit `^?`
which should match folks stty verase.   Heads up to @fanzeyi!

I've tested this only on a linux system so far and will follow up on
a macOS system a little later today.

Refs: https://github.com/wez/wezterm/issues/88
Refs: https://github.com/wez/wezterm/issues/63
2019-12-30 08:14:20 -08:00
Wez Furlong
682bb0d3fd add missing comment 2019-12-28 08:37:19 -08:00
Wez Furlong
68a2d9f159 Adjust default scroll thumb color
I think #222 looks much cooler than #444
2019-12-23 18:08:15 -08:00
Wez Furlong
f350b24220 fix tests 2019-12-23 14:52:49 -08:00
Wez Furlong
aac93e7f0a Improve palette handling w/ live config reloading
@fanzeyi ran into part of this issue when using multiplexing;
tabs from a remote domain always used the default color scheme
rather than the local configuration file color scheme.

Another variation on this is that making changes to the `[colors]`
section of the config only impacts tabs created after the change
was loaded, rather than updating the running tabs.

The root of this was that each terminal was keeping its own
copy of the palette that was updated at creation time to reflect
the config file.  Relatively recently I introduced a new trait
to allow the terminal state to reach out and obtain configuration
from another source.

This commit connects the terminal configuration layer to the
configuration file directly.

The color schemes are now pulled directly from the configuration
file, except in the case where a dynamic color scheme has been
applied: using escape sequences to change the colors causes
the palette to be forked away from the configuration file.

There's still a low pri TODO around this space: if we're connected
to a remote domain and someone uses dynamic color scheme escapes,
should we reflect those locally?  If so then we'll need to build
some plumbing to transport the palette to/from the remote system.

Closes: https://github.com/wez/wezterm/pull/60
2019-12-23 14:19:48 -08:00
Wez Furlong
f28d9e994f Enable mouse interaction with scroll bar
This commit:

* Removes the ability to drag the window by the tab bar.  I added
  that in anticipation of needing to do custom title bar dragging
  with Wayland, but it turned out both to be not required and not
  possible to drag windows around in that way.
* Replaces the drag logic with dragging the scrollbar thumb
* Clicking above the scrollbar thumb is equivalent to page up
* Clicking below the scrollbar thumb is equivalent to page down
2019-12-22 22:01:00 -08:00
Wez Furlong
ec609a2e41 Add optional scroll position UI
This commit adds a scrollbar that shows the scroll position but
that does not currently allow dragging to scroll.

The scrollbar occupies the right hand side window padding.

The width of the scrollbar can be set by explicitly configuring
`window_padding.right`.  If the right padding is set to 0 (which
is its default value), and the scroll bar is enabled then the cell
width will be used for the right padding value instead.

The scrollbar can be enabled/disabled via this config setting:

```
enable_scroll_bar = true
```

Its color by this:

```
[colors]
scrollbar_thumb = "#444444"
```

(Note that color palette config will be reloaded when the config
file is changed, but you'll need to spawn a new tab/window to
see the effects because we cannot assume that a config reload should
always replace a potentially dynamically adjusted color scheme in
a tab).
2019-12-22 20:12:56 -08:00
Wez Furlong
c961f934f2 renderer now renders different cursor styles
refs: https://github.com/wez/wezterm/issues/7
2019-12-22 13:08:57 -08:00
Wez Furlong
8135ce46a5 Blink the cursor when it is set to blink
The blink rate is configurable via a new option.

Refs: https://github.com/wez/wezterm/issues/7
2019-12-22 10:08:31 -08:00
Wez Furlong
986095e6f5 connect DECTCEM to the stored cursor shape
We don't render the different types of cursor yet, but at least we're
tracking what it should be.
2019-12-22 09:07:34 -08:00
Wez Furlong
5abc4e543e rendering now respects cursor visibility
This commit adds some plumbing for describing the cursor shape
(block, line, blinking etc) and visibility, and feeds that through
the mux and render layers.

The renderer now knows to omit the cursor when it is not visible.
2019-12-22 08:52:51 -08:00
Wez Furlong
f493139305 clippy 2019-12-21 23:13:26 -08:00
Wez Furlong
9a2c7a1485 failure -> anyhow + thiserror 2019-12-14 21:43:05 -08:00
Wez Furlong
901dc9c395 re-structure clipboard handling for mux
The wayland changes rendered clipboard handling for remote multiplexers
broken, and this commit makes it work again.

It removes the clipboard concept from the the TerminalHost and
keeps it separated as the term::Clipboard concept.

The muxer now has plumbing for passing the Clipboard to its idea
of Windows and Tabs and this is hooked up at window creation and
domain attach time.
2019-12-01 13:31:12 -08:00
Wez Furlong
4ef20480c5 wayland: implement clipboard
This was honestly a PITA because of its complexity.  The `clipboard`
crate (now dropped as a dep) didn't support wayland, so I looked at
the `smithay-clipboard` crate, which caused all of my input to become
laggy just by enabling it--even without actually copying or pasting!

Both of those crates try to hide a number of details of working with
the clipboard from the embedding application, but that works against
our window crate implementation, so I decided to integrate it into
the window crate using Futures so that the underlying IPC timing and
potential for the peer to flake out are not completely hidden.

This first commit removes the SystemClipboard type from wezterm
and instead bridges the window crate clipboard to the term crate
Clipboard concept.

The clipboard must be associated with a window in order to function
at all on Wayland, to we place the get/set operations in WindowOps.

This commit effectively breaks the keyboard on the other window
environments; will fix those up in follow on commits.
2019-11-29 12:17:52 -08:00
Wez Furlong
fd78a0b3ce Allow reloading hyperlink rules from the config at runtime 2019-11-24 13:12:54 -08:00
Wez Furlong
7c7825c070 term: extract configuration to a trait
This isn't complete but begins the process of extracting
the embedding application configuration into a trait provided
by the application rather than passing the values in at
construction.

This allows the application to change configuration at
runtime.

The first option to handle this is the scrollback size.
2019-11-24 12:43:41 -08:00
Wez Furlong
517084ff2f clippy 2019-11-24 07:20:41 -08:00
Wez Furlong
d778d8b130 disable csi-u sequences by default
I keep holding shift while pressing space and seeing stuff get
undone in vim.  Super annoying.  I didn't see a good way to
teach applications about this via terminfo, so this is off
by default for now.

refs: https://github.com/wez/wezterm/issues/63
2019-11-23 15:04:54 -08:00
Wez Furlong
6289c08a4e Adopt CSI u modifier encoding for keypresses
See http://www.leonerd.org.uk/hacks/fixterms/ for the specification.

Refs: https://github.com/wez/wezterm/issues/63
2019-11-16 13:38:03 -08:00
Wez Furlong
9e3c6a4ef9 term: simplify key -> escape sequence mapping
refs: https://github.com/wez/wezterm/issues/63
2019-11-16 09:04:55 -08:00
Wez Furlong
ec3690d9c1 allow alt + punctuation
I noticed that alt-. wasn't working; it was an unintended
casualty of 03f51f7be2
2019-11-05 21:12:19 -08:00
Wez Furlong
11137aa613 alt + arrow keys 2019-11-05 20:14:49 -08:00
Pedro Rittner
579da93ded Support GNUReadline-style Alt-Backspace
Alt-Backspace is the GNUReadline-style shortcut for kill-previous-word.
In wezterm, this currently doesn't work, since this gets trapped by the generic `Backspace` match case.
This diff adds a more specific case for when Backspace is combined with Alt to produce the correct sequence.

This is definitely a hack and there should probably be a more general solution for GNUReadline combinations, but this solves the immediate problem.
2019-11-05 10:33:22 -08:00
Wez Furlong
1ab438c1e2 improve emoji width calculation
I noticed while scrolling `emoji-test.txt` that some of the combined
emoji sequences rendered very poorly.  This was due to the unicode
width being reported as up to 4 in some cases.

Digging into it, I discovered that the unicode width crate uses a
standard calculation that doesn't take emoji combination sequences
into account (see https://github.com/unicode-rs/unicode-width/issues/4).

This commit takes a dep on the xi-unicode crate as a lightweight way
to gain access to emoji tables and test whether a given grapheme is
part of a combining sequence of emoji.
2019-11-05 08:45:08 -08:00
Wez Furlong
a9bdca6d84 bump up to latest unicode segmentation crate 2019-11-04 22:12:21 -08:00
Wez Furlong
03f51f7be2 macos: fix alt+<ascii> key being passed to terminal
This was an unintended casualty of the recent gui layer refactoring.

If you press `option-h` macos generates DOT ABOVE which we pass through
to the terminal key processing layer.  It sees that ALT is set and emits
an escape byte (to indicate that ALT is set) followed by the UTF-8
sequence for DOT ABOVE.  `zsh` gets confused and treats this as
`<ffffffff>` in its line editor.

This diff restricts the emission of the ESC leader to ascii alphanumeric
characters only.

There needs to be a followup diff to allow configuring how we process
these ALT modified characters on macOS because our current behavior
breaks eg: `ALT-1` which is a hotkey that I use in tmux.  Granted that
I don't need tmux with end to end wezterm, but it does prevent me from
using that if I wanted to.
2019-11-04 18:46:40 -08:00
Wez Furlong
155a972425 add missing selection normalize calls
I saw

```
thread 'main' panicked at 'you forgot to normalize a SelectionRange', term/src/selection.rs:94:9
```
2019-11-03 22:01:35 -08:00
Wez Furlong
d80169ceff Avoid accidental application mode delete output in key processing
I thought that I'd broken something with the DEL processing in vim with
the new frontend but it turned out that the other frontend was emitting
BS always and that I'd actuall unbroken passing DEL through and that
other layers were translating DEL into an application cursor mode output
for DEL that emits a totally different sequence.

This diff preserves DEL and disables that other sequence.

Will follow up with some explicit configuration to control this
behavior, but in the short term, the default behavior should be much
closer to what people actually want and expect!

refs: https://github.com/wez/wezterm/issues/52
2019-10-27 23:59:15 -07:00
Wez Furlong
04d6fed848 fixup tests for recent api changes 2019-10-27 09:04:42 -07:00
Wez Furlong
12e71a594a teach the terminalstate about pixel sizes
This allows more accurate slicing of images when processing
iterm2 image sequences
2019-10-26 23:58:39 -07:00
Wez Furlong
d97a84f984 render iterm2 image protocol in the software renderer
This is still a bit rough because the terminal parser doesn't
understand the pixel sizes, so it relies on the hard coded
cell dimensions being accurate.
2019-10-26 23:30:39 -07:00
Wez Furlong
71b4f52e5e clippy 2019-10-26 13:22:16 -07:00
Wez Furlong
c30ffc2226 prevent terminal from sizing to 0 rows or cols 2019-10-26 12:36:18 -07:00
Wez Furlong
52a65370fa cargo fmt with rust 1.38 2019-09-28 21:40:40 -07:00
Wez Furlong
950a7d2b22 cargo fix dyn 2019-09-28 20:29:48 -07:00
Wez Furlong
5440cbe521 replace vte with our own vtparse crate
This enables using large OSC buffers in a form that we can publish
to crates.io without blocking on an external crate.  Large OSC
buffers are important both for some tunnelling use cases and for
eg: iTerm2 image protocol handling.
2019-06-29 16:28:39 -07:00
Wez Furlong
49894385dd update tests for clipboard changes 2019-06-21 09:12:01 -07:00
Wez Furlong
e993e5a625 allow capturing the clipboard impl from the terminal host
This should allow asynchronous access to the clipboard, which
in turn will allow the server to send the clipboard to the client
unilaterally.
2019-06-20 07:55:03 -07:00
Wez Furlong
764597851c allow collapsing mouse events in the mux protocol
Repeated moves or wheel events are collapsed so that we don't clog up
the queue.  The queue size doesn't matter as much as the latency of
processing a large queue.  For fast or repeated moves the queue can grow
rather quickly, and with what is currently ~25-50 ms round trip per
entry for a remote session, that is a poor UX.
2019-06-16 21:04:53 -07:00
Wez Furlong
302db2c976 a lighter way to pass selection ranges for client tabs 2019-06-16 21:04:53 -07:00
Wez Furlong
d061303bb4 don't forget to copy in the configured color palette! 2019-06-16 14:49:54 -07:00
Wez Furlong
86cd39eb4e we can now send input to a client tab 2019-06-09 16:33:57 -07:00
Wez Furlong
b43c207167 remove defunkt write_all function
This was from a time when we were miusing non-blocking io
2019-06-09 07:36:30 -07:00
Wez Furlong
8055957406 clippy 2019-06-09 07:33:00 -07:00
Wez Furlong
5bf2268292 more log changes 2019-06-08 15:30:47 -07:00
Wez Furlong
99919dc807 implement answerback for osc 4, 10-18
These codes are used to change the color palette, but if the `?`
string is used in place of a color spec, then we must respond with
the current color value string for that palette entry, so lets
implement that!
2019-06-02 12:19:58 -07:00
Wez Furlong
8f8d03fc05 support osc 10-19 dynamic color changing 2019-06-01 21:47:25 -07:00
Wez Furlong
276e9aef91 osc 4 accepts multiple parameters 2019-06-01 19:59:44 -07:00
Wez Furlong
4193442ec8 make OSC 4 actually change the palette 2019-06-01 16:15:37 -07:00
Wez Furlong
6e4db86f7e add palette to the terminal state 2019-06-01 15:55:08 -07:00
Wez Furlong
d18dbe9ff7 parse OSC 4
This code is used to change the color palette at runtime.
We can parse it but not do anything useful with it yet.
2019-06-01 15:39:46 -07:00
Wez Furlong
98bd82e212 bump some deps 2019-05-27 20:08:30 -07:00
Wez Furlong
0bb3714435 improve double-click selection of wrapped lines
This one has been bugging me for a while; we now know when we've
wrapped a line and can join it without a line break when double-clicking
to select a word.

This commit introduces a wrapped attribute to help record this
information, which could potentially help with when it comes
to looking at nicer resize behavior in refs: https://github.com/wez/wezterm/issues/14
2019-05-26 16:05:51 -07:00
Wez Furlong
09f168a0db plumbing for double click selection of wrapped lines 2019-05-26 14:52:03 -07:00
Wez Furlong
038100922a clippy 2019-05-26 12:49:10 -07:00
Wez Furlong
607e180122 Range::contains is now stable; use it. 2019-05-26 11:40:33 -07:00
Wez Furlong
f87901c484 tidy up some failure usage 2019-05-26 08:58:59 -07:00
Wez Furlong
8a76f27f9b remove some extern crates
These got overlooked when migrating from 2015->2018 edition syntax.
2019-05-26 08:27:43 -07:00
Wez Furlong
b83656b378 bump image crate dep
This avoids compiling two different versions of image
2019-05-26 08:13:24 -07:00
Mark Thomas
fb636995c8 separate application cursor keys
Application cursor keys are a separate set of encodings that applications can
ask the terminal to produce for cursor keys.

Unfortunately, PuTTY generates these for shift-modified cursor keys.  If an
application is to distinguish between normal and shift-modified cursor keys
on PuTTY then it will need to be able to distinguish between normal and
application cursor keys.

Add new `KeyCode` variants for application cursor keys.
2019-05-18 09:12:46 -07:00
Wez Furlong
acc895f1cd avoid deadlock while pasting large chunks of text
A big paste could saturate the input/output of the pty and
lead to an effective deadlock; the application wants to send
output to us but we are busy trying to write the paste to it.

Break up large pastes into chunks and send them piece by piece.
This does mean that a large bracketed paste is not an atomic
unit any longer, but it seems to work out ok when pasting into
vim.
2019-03-23 15:25:49 -07:00
Wez Furlong
3777da13d2 fix deprecation warnings 2019-03-22 22:17:54 -07:00
Wez Furlong
fa9bf57e86 fix line feed movement behavior
We were incorrectly treating it as \r\n, but it should only have
been moving vertically.

This fixes the positioning of the cursor when using eg:

`dialog --yesno hello 0 0`

Without this change, the cursor would be way over to the left.
With this change, the cursor is correctly positioned inside
the "YES" box.
2019-03-22 22:14:17 -07:00
Wez Furlong
49467515d6 when erasing the display ensure line size matches physical
In the case where the screen was enlarged, we don't eagerly resize
the line vectors.

If a subsequent erase display occurred, we'd only erase to the old
size of the lines, rather than the new size, which could result
in a black square in the upper right corner of the display.

Repro scenario is:

* resize window larger than initial height
* `dialog --yesno hello 0 0`

The dialog background should fill the display.
2019-03-22 21:59:54 -07:00
Wez Furlong
cbc1462bb4 fix color of erased characters
This was responsible for eg: dialog rendering a black (or whatever
the default background color was) strip behind the text in an
invocation like:

`dialog --yesno hello 0 0`

Rather than render a default cell, render a blank cell using the
current pen.
2019-03-22 21:45:51 -07:00
Wez Furlong
54324121f2 implement basic DEC Line drawing mode
This improves the rendering of eg: `dialog`
2019-03-22 21:28:42 -07:00
Wez Furlong
222e278720 adopt OneBased type for a number of row/col escape sequences 2019-03-22 20:41:50 -07:00
Wez Furlong
29c7610ead add OneBased helper 2019-03-22 20:41:50 -07:00
Wez Furlong
e68bf65b2f clean up some of the newer escape sequence processing 2019-03-22 20:41:50 -07:00
Wez Furlong
3003654cc8 fix apt upgrade scrolling issue
This was an off-by-one issue when using scroll margins just shorter
than the screen and when scrollback is enabled.

Added a unit test to verify the behavior.
2019-03-22 20:41:50 -07:00
Wez Furlong
6cbb3ba432 impl IRM insert mode and improve esctest conformance
I've had mixed results with esctest; the IRM and cursor save/restore
tests fail for me in terminal.app, iterm2 and xterm, and fail in the
same way on wezterm, so I'm not sure if I'm not running those tests
correctly.  However, they did encourage the discovery of some other
real issues in the wezterm emulation.
2019-03-22 20:41:50 -07:00
Wez Furlong
9702d1cf5a Add plumbing for running esctest 2019-03-22 20:41:50 -07:00
Wez Furlong
c33bbc8f23 clamp scroll values rather than asserting
I've been looking at https://gitlab.freedesktop.org/terminal-wg/esctest/tree/master
to verify some behaviors and found that it would send out of range
values that would cause wezterm to panic.  Rather than panic, just
clamp.
2019-03-22 20:41:50 -07:00
Wez Furlong
bdfef1fd79 implement Window::ReportTextAreaSizeCells 2019-03-22 20:41:50 -07:00
Wez Furlong
fd2e5855a5 Implement CSI REP 2019-03-22 20:41:50 -07:00
Wez Furlong
2c32eb9337 recognize window management related CSI
These were showing up as unrecognized sequences on my mac, and I
wondered what they were.  We now parse them and do nothing with
them, other than print out the parsed form :)
2019-03-22 20:41:50 -07:00
Wez Furlong
1a883a40e9 use vte with larger OSC buffer support
I wanted to see how much work remains to enable iterm2 image
display; one of the blockers was a limit in the size of the
buffer in the vte crate, which has been removed in my fork
of vte.

As part of testing our ability to absorb that data, I found
a couple of issues with applying the image cells to the display,
so this commit also takes care of that.

We still don't have code to connect the cell image data to the
opengl render layer.
2019-03-22 20:41:50 -07:00
Wez Furlong
217ad94c80 fixup tests for Rc<Hyperlink> -> Arc<Hyperlink> change 2019-03-22 20:41:50 -07:00
Wez Furlong
fe7502fc0b implement coarse tab data rpc PoC
This required switching away from Rc to Arc so that the data in the
client can transit between threads.

This isn't useful yet.
2019-03-22 20:41:50 -07:00
Wez Furlong
7cdd1876d1 Enable serializing various Line and Cell related structs 2019-03-22 20:41:50 -07:00
Wez Furlong
e773cff24e adjust tests for pty -> Write changes 2019-03-02 12:29:17 -08:00
Wez Furlong
6c8a9e999e splitting writer out of Tab::pty() 2019-03-02 11:27:11 -08:00
Wez Furlong
0c3410fb6a factor out more of the mouse processing 2019-03-02 09:45:10 -08:00
Wez Furlong
61e7f2d0fe slightly refine some mouse processing code 2019-03-02 09:40:05 -08:00
Wez Furlong
bc15fc4665 split mouse event processing into separate functions 2019-03-02 09:33:58 -08:00
Wez Furlong
5565ccd30e remove host from key_down signature 2019-03-02 09:33:58 -08:00
Wez Furlong
8f13e53ac8 move gui keyboard shortcut processing to guicommon 2019-03-02 09:33:58 -08:00
Wez Furlong
f261f079f7 lift clipboard hotkeys up to gui layer
My original idea was that I would centralize of the key binding
logic in the terminalstate, but this places a bit of a burden on
the TerminalHost portion of the interface.

In particular: when running a multiplexer server we may be headless
or have multiple heads.  In that scenario we want the terminal
to be backed by a virtualized screen, and that means removing
the direct callback to access eg: the host clipboard.  This
diff is the first of a couple that have the goal of removing
those sorts of dependencies.
2019-03-02 09:33:58 -08:00
Wez Furlong
d7b55382b4 big initial mux change
This is an unfortunately large diff that:

* Separates Tab ownership from TerminalWindow
* Introduces a Mux container for all of the tabs in the application,
  across all windows
* Moves ownership of processing pty responses to the mux; it sets
  up and has logic to process data for the ptys and apply to the
  tabs

I've moved the logic for processing new tab and new window hotkeys
to the TerminalWindow's themselves as we need some context to
associate the tab with the right window and to create a new window.

I think that will simplify and allow unifying more code.
2019-02-25 00:03:35 -08:00
Wez Furlong
184befae09 adjust double-click selection class
previously this just used unicode word segmentation rules, but that
is insufficient for most technical users.

Change this to look for sequences that are non-whitespace and not
enclosed by bracket/quote delimiters.  This allows selecting file names
with a double click, which was my main issue.
2019-02-24 13:13:35 -08:00
Wez Furlong
dba88d2102 clippy 2019-02-24 12:01:08 -08:00
Wez Furlong
db5aac6681 implement tabs in the glutin gui system
There's a bunch of code duplication that I want to clean up later.
2019-02-23 13:33:32 -08:00
Wez Furlong
5b126b3f1e Restore fullscreen toggle hotkey and fixup for macos 2019-02-23 13:27:59 -08:00
Wez Furlong
b448cfec4d fix shift-insert for paste on linux
the match guard was applying to both arms, so break
this into two separate matches
2019-02-22 20:31:04 -08:00
Wez Furlong
c818225a5d ctrl|cmd +/- to manipulate font size with glutin backend
Simliar code needs to be added to the x11 backend in a follow on
commit.

Refs: https://github.com/wez/wezterm/issues/2
2019-02-22 15:22:31 -08:00
Wez Furlong
42fb687759 more fun with keyboard input with glutin/winit
There isn't really any reliable consistency in the virtual_keycodes
being set for simple keys or shifted keys, so we need to go all in
and add our own scancode processing as a fall back.

This makes it even harder to process unicode input, particularly
because we have no idea whether a ReceivedCharacter event will
follow.
2019-02-20 20:30:19 -08:00
Wez Furlong
9f6b21f0db update term to 2018 edition 2019-02-18 23:20:59 -08:00
Wez Furlong
9c9261f332 fix delete on macos 2019-02-18 03:04:48 -08:00
Wez Furlong
1252eaf153 CMD-V -> paste 2019-02-18 02:47:00 -08:00
Wez Furlong
2db17562a6 rustfmt 2019-02-16 00:08:38 -08:00
Wez Furlong
61fec42216 cargo fmt with current stable rustfmt 2018-09-19 20:06:31 -07:00
Wez Furlong
3d3a718182 Fixup phantom release mouse code when using mouse wheel
This was breaking scrolling in vim
2018-09-04 00:34:53 -07:00
Wez Furlong
62d43ddd63 avoid panic when some clients change scroll margins 2018-08-09 00:04:28 -07:00
Wez Furlong
9219dbb327 We can now take iterm images into the wezterm terminalstate
We don't yet have any code to render them, and the vte parser seems
to truncate incoming image sequences ~1kb in size, so more work is
needed to make this useful.
2018-08-08 09:00:07 -07:00
Wez Furlong
2f8ffab213 parse and encode some iTerm specific escape sequences 2018-08-06 01:23:25 -07:00
Wez Furlong
dfa3ef5ae6 fix missing paren for the bell print 2018-08-05 17:22:46 -07:00
Wez Furlong
a8ae14bb6b fix panic when resizing smaller leaves the cursor off screen 2018-08-05 16:32:29 -07:00
Wez Furlong
60c24a9e41 consolidate on one set of input keycodes and modifiers 2018-08-05 14:28:29 -07:00
Wez Furlong
c0ea601645 add helper for managing primary and alt screen 2018-08-05 13:49:03 -07:00
Wez Furlong
cee63e74e1 consolidate term::Line -> termwiz::Line 2018-08-05 12:37:01 -07:00
Wez Furlong
2c7a27c42a move CellCluster to termwiz 2018-08-05 12:10:50 -07:00
Wez Furlong
18f34545b3 rustfmt 2018-08-05 09:14:40 -07:00
Wez Furlong
e2461b2380 add concept of implicit hyperlink to termwiz
Moves that functionality from wezterm+term into termwiz
2018-08-05 09:13:55 -07:00
Wez Furlong
8a188cfd74 tweak manifest to point to in-tree termwiz 2018-08-05 08:00:45 -07:00
Wez Furlong
5482323be5 really fix the erase in display issue
We also need an implicit erase in line in the appropriate direction
2018-08-04 23:23:04 -07:00
Wez Furlong
899593745e fix growing bounds for Line::set_cell 2018-08-04 20:18:02 -07:00
Wez Furlong
e0b6fbfb1f fix off-by-one for EraseInDisplay
We were deleting the current row and below rather than the rows below.
This was the cause of lines going blank during `apt upgrade` runs;
the line just above the bottom would get erased instead of scrolling
up.

I found this by running the termwiz widget demo; the top line was being
erased by mistake.
2018-08-04 19:28:18 -07:00
Wez Furlong
6c1f089f13 buffer processing in Performer::print
This helps to accumulate multi-char grapheme sequences into a single
cell.
2018-08-04 19:02:46 -07:00
Wez Furlong
10f0403973 improve encapsulation of Line struct 2018-08-04 18:33:44 -07:00
Wez Furlong
381e572700 relax some of the dep requirements 2018-08-04 15:35:38 -07:00
Wez Furlong
a597a23aef fix cargo fmt 2018-08-04 14:30:34 -07:00
Wez Furlong
e0cc46fe4f log unhandled cursor shape sequence 2018-08-04 12:43:15 -07:00
Wez Furlong
204d741be7 improve display for unhandled csi 2018-08-04 11:59:20 -07:00
Wez Furlong
b7a095ef3f Update to use termwiz hosted on github 2018-08-04 09:46:46 -07:00
Wez Furlong
472d243a33 cut over to termwiz Cell 2018-08-04 09:35:39 -07:00
Wez Furlong
1ec83706e7 use termwiz::Hyperlink 2018-08-04 00:26:24 -07:00
Wez Furlong
f37de9cbe5 use termwiz to replace most of the escape parsing 2018-08-03 22:37:04 -07:00
Wez Furlong
039eadc05f update rustfmt 2018-07-11 08:30:49 -07:00
Wez Furlong
8fae5f56a8 remove dead_code marker from some exported constants 2018-07-11 08:14:09 -07:00
Wez Furlong
8b24d34a74 fix panic for large pastes 2018-04-28 21:54:39 -07:00
Wez Furlong
d73892a4fd update for recent rustfmt changes
No functional changes
2018-04-11 13:15:12 -07:00
Wez Furlong
197819db6d Add basic support for ICH which is used by bash CTRL-R 2018-03-09 22:15:06 -08:00
Wez Furlong
ff5a3179e1 new windows with Cmd-N 2018-03-04 17:17:37 -08:00
Wez Furlong
68bb0e859e Show tab number in title bar when there are tabs 2018-03-04 17:06:06 -08:00
Wez Furlong
c5ce3e2621 Add CMD-[0-9] as shortcut for tab switching 2018-03-04 16:52:40 -08:00
Wez Furlong
edf44c9c48 We can now spawn and switch tabs! 2018-03-04 16:46:14 -08:00
Wez Furlong
816925424a add basic tab related key bindings 2018-03-04 13:31:16 -08:00
Wez Furlong
88473e5a09 move window/tab/fullscreen related to TerminalHost 2018-03-04 09:13:36 -08:00
Wez Furlong
5db84856e9 clippy 2018-03-03 13:27:28 -08:00
Wez Furlong
7b7b7cff46 Add support for OSC 52, clipboard
We only allow setting, not reading, the clipboard.
2018-03-01 00:20:15 -08:00
Wez Furlong
80f114c3ee stubs for a couple of OSC sequences
These do nothing, but at least we don't spew about them.
2018-02-28 23:32:30 -08:00
Wez Furlong
28aafa4a73 Improve printing of unknown OSC 2018-02-28 23:09:00 -08:00
Wez Furlong
f986e0c6d8 Properly check the range intersection for invalidating selection 2018-02-28 22:07:48 -08:00
Wez Furlong
f3149a5bf6 Clear the selection rendering when the cells change
I think this covers it... I need to follow up with some test coverage.

Fixes: https://github.com/wez/wezterm/issues/9
2018-02-28 09:06:51 -08:00
Wez Furlong
9ad9360075 Update tab stops when resizing
The issue here was that we were not updating the tab stops when making
the window larger.  This had the side effect of causing the cursor to
move in unexpected ways when tabbing to the right.

Fixes: https://github.com/wez/wezterm/issues/13
2018-02-28 00:15:54 -08:00
Wez Furlong
a274700cb8 figure out what a couple of sequences used by mc are
But don't do anything to implement them yet
2018-02-27 21:33:02 -08:00