1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-20 11:52:18 +03:00
Commit Graph

2203 Commits

Author SHA1 Message Date
Wez Furlong
5b57f5f9ff termwiz: line editor: exit completion state for a single completion result 2020-04-08 10:07:15 -07:00
Wez Furlong
11c7e29b59 termwiz: windows: toggle autonewline when toggling cooked/raw
Without this, `wzsh` will keep the terminal in raw mode between
line editor invocations, resulting in staggered/stairway output
for any spawned commands.
2020-04-08 08:57:26 -07:00
Wez Furlong
db845db55b termwiz: line editor: allow for multi-line prompts 2020-04-07 22:06:05 -07:00
Wez Furlong
22250662b3 docs: fix typo 2020-04-07 08:49:14 -07:00
Wez Furlong
3ead0906a2 docs: more tweaks 2020-04-07 08:45:57 -07:00
Wez Furlong
38937ce1c3 docs: add more information about the available lua functions 2020-04-07 08:37:40 -07:00
Wez Furlong
56f20d3b80 docs: add missing lua marker to code block 2020-04-07 07:39:00 -07:00
Wez Furlong
912af724f9 docs: add js fixup to the deploy action too 2020-04-06 17:47:57 -07:00
Wez Furlong
d27b9382be docs: add missing lua language markup 2020-04-06 17:41:10 -07:00
Wez Furlong
ae5cfec1f4 docs: enable syntax highlighting for lua
This is a bit gross, but it works!
2020-04-06 17:39:57 -07:00
Wez Furlong
ffa4925da4 docs: update for lua configuration syntax 2020-04-06 16:32:16 -07:00
Wez Furlong
6457dfa0af Update changelog 2020-04-06 15:25:46 -07:00
Wez Furlong
5b700e4d5d wezterm: recognize MS terminal mode 25 for cursor visibility 2020-04-06 13:19:44 -07:00
Wez Furlong
61e3545c68 pty: windows: allow loading a newer conpty dll
This commit allows loading the console functions from `conpty.dll`
instead of `kernel32.dll` which means that we can update and
track newer features than have been deployed to Windows.

In practical terms this means that we can now unlock mouse input
reporting in eg: VIM running under WSL.
refs: https://github.com/microsoft/terminal/issues/376

We're jumping the gun on this issue, which is tracking making
a proper supportable way to deploy this sort of update:
refs: https://github.com/microsoft/terminal/issues/1130

For now it seems easier just for us to bundle our own copy of
these bits.

This includes a speculative change to include those in our
Windows downloads also.

The binaries were built from
4f8acb4b9f
2020-04-06 12:48:54 -07:00
Wez Furlong
d98fee9e0b termwiz: windows: allow ESC to be recognized again
After processing a batch of input records, we need to effectively
flush any pending ambiguous sequences in order to register a lone
ESC key press.
2020-04-06 10:13:49 -07:00
Wez Furlong
b279bb68e0 termwiz: windows: auto-detect virtual terminal support
With the revised native windows console renderer using the various
console APIs more deeply, I've seen a couple of cases where those
API calls fail inside eg: wezterm running via the new pty machinery.

Using the virtual terminal APIs and the terminfo renderer is the
right thing to do in that case.

This commit probes for virtual terminal support and uses the builtin
xterm terminfo, unless the environment has
`TERMWIZ_BYPASS_VIRTUAL_TERMINAL=1` set.  This allows forcing the
use of the windows console layer.
2020-04-06 09:51:15 -07:00
Wez Furlong
92fa32695c termwiz: windows: fixup viewport handling
Some windows APIs have inclusive dimensions and some exclusive;
we were off by one for the height of the display which led to some
weirdness with eg: `sp` and the line editor.

When it comes to scrolling: if the scroll request is for the entire
viewport then we simply adjust the viewport; this is desirable because
it allows data to scroll back into the history in the native console.
2020-04-06 09:33:52 -07:00
Wez Furlong
290bc5567e termwiz: windows: tidy up flushing a bit 2020-04-06 07:52:56 -07:00
Wez Furlong
03ab5ea659 termwiz: windows: fix bounds check for cursor positioning 2020-04-05 21:00:54 -07:00
Wez Furlong
58c07b6da0 termwiz: line editor: fixup cursor positioning for multiline
This fixes the math around cursor positioning for the edge case where
the width of text and the cursor position are close to the width of
the terminal.
2020-04-05 20:46:41 -07:00
Abby Edwards
1b2baa5f76 Preserve clipboard contents on single left click 2020-04-05 19:32:59 -07:00
Wez Furlong
96880a08b4 termwiz: improve performance of windows console renderer
This reduces flickering updates in the native windows console;
it works by taking a copy of the screen buffer, applying the
Change's to that buffer and then copying back to the console.
2020-04-05 19:15:48 -07:00
Wez Furlong
fe89082764 termwiz: remove Position::NoChange, fixup multiline line editing and moar!
This is unfortunately a bit of a muddy commit and I'm too lazy to split
it up.

* Removed `Position::NoChange`; use `Position::Relative(0)` instead
* Added missing cursor positioning cases in the terminfo renderer
* Taught line editor about the cursor position when the line spans
  multiple physical lines
* Taught the Windows input layer to process escape sequences for eg:
  the arrow keys when running with virtual terminal enabled.
* Removed the hack that under-reported the terminal width; the hack
  was present to make some aspects of rendering with the native windows
  console logic easier, but it was getting in the way of the line
  editor.  This may well break something, but it fixed up the line
  editor :-/

cc: @markbt
2020-04-05 11:14:08 -07:00
Wez Furlong
6d5a7ad143 termwiz: ensure virtual terminal processing is enabled on windows
I'm not sure if this is strictly needed as it seems to be the default
for the ways that I interact with windows (via wezterm and via ssh).
2020-04-04 18:02:47 -07:00
Wez Furlong
aaf3a7fcaf termwiz: allow using terminfo on Windows
This commit changes the behavior on Windows:

* If $TERM is set and the `terminfo` crate is able to
  successfully initialize and locate a terminfo database (this also
  requires that $TERMINFO be set in the environment), then we'll
  use the `TerminfoRenderer` instead of the `WindowsConsoleRenderer`
* If $TERM is set to `xterm-256color` and no terminfo database was
  found, use our modern compiled-in copy (look in the `termwiz/data/`
  directory for the source and compiled version of this) and use
  the `TerminfoRenderer`.
* Otherwise use the `WindowsConsoleRenderer`.

In practice, this allows termwiz apps to opt in to features such as
true color support on Windows 10 build 1903 an later by setting their
`TERM=xterm-256color`.   This happens to be the default behavior when
`ssh`ing in to a windows host via `wezterm`.

You can see the truecolor mode get applied by running this example:

```
cargo run --example widgets_basic --features widgets
```

with TERM set as above the background region that is painted by the app
will be a blueish/purplish color, but with it unset or set to something
invalid, it will fall back to black.

I'd like to eventually make termwiz assume the equivalent configuration
to `TERM=xterm-256color` by default on Windows 10 build 1903 and later,
but it's worth getting some feedback on how this works for clients such
as `streampager`.

cc: @quark-zju and @markbt
2020-04-04 17:52:53 -07:00
Wez Furlong
fb6d0bbc7c termwiz: windows: fix default text foreground color
We were defaulting to bright white for `CellAttributes::default()`
rather than standard grey.

heads up @quark-zju and @markbt
2020-04-04 13:52:20 -07:00
Wez Furlong
466961f9c3 tabout: allow tabulating Change slices for colorized output 2020-04-04 13:40:45 -07:00
Wez Furlong
6c9052b1a5 tabout: prep for publish 2020-04-04 11:32:37 -07:00
Wez Furlong
e6cc28a813 mux: use approx rtt to decide whether to use predictive echo
We'll only use it if it looks like the latency is over 100ms.
2020-03-31 08:41:53 -07:00
Wez Furlong
4e50c10d1c cargo update 2020-03-29 08:19:16 -07:00
Wez Furlong
54cc62ccf9 ctrl-space should send NUL 2020-03-28 18:32:20 -07:00
Wez Furlong
3fd4e74a81 cargo update 2020-03-14 09:39:38 -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
382b8f53dd predictive echo: make the password check more broad 2020-03-13 21:14:05 -07:00
Thom Chiovoloni
cfc22c1fcb Update comment based on review feedback 2020-03-13 21:05:43 -07:00
Thom Chiovoloni
0874b03d65 Add support for more more sequences to the input parser's keymap 2020-03-13 21:05:43 -07:00
Wez Furlong
9d89241a66 mux: add input event serial number to key events and render responses
This should allow some basic reasoning about how in sync we are with
the remote system.

The immediate application of this is to try to avoid wiggling the
text cursor when the predictive echo updates the position locally.

I need to push this in order to test it on my higher latency setup,
so I don't know if this is totally effective yet.
2020-03-10 08:34:47 -07:00
Wez Furlong
e7d8068ad9 connui: add a sleep_with_reason method
This is used to indicate timeout/retries during connection establishment
and also to count down to the automatic window close.

The UI will render a progress bar underneath the reason text to show
the passage of time, as well as counting down the provided duration.
2020-03-08 10:00:08 -07:00
Wez Furlong
73c0c02ffb window: x11: adjust log level for a debug print 2020-03-08 08:40:46 -07:00
Wez Furlong
446b3f7fd5 mux: improve predictive local echo
Extends the "predictions" to allow for some basic cursor movement
via cursor keys and text deletion.

In addition, show predictions for pasted text.

refs: https://github.com/wez/wezterm/issues/127
2020-03-08 08:36:52 -07:00
Wez Furlong
061d53bcfa mux: add basic "predictive" local echo
This is a mosh-like feature, but not as sophisticated.

The goal is to reduce perceived latency by making a reasonable
guess about how the line where the cursor is located will change
in response to a key press.

At the moment the guess has some very basic heuristics:

* The key is an unmodified (no CTRL, ALT, SUPER) `char` value
* The line containing the cursor doesn't appear to be a
  password prompt (using a very simple English specific test)

In those conditions, we'll update the local line cache and cursor
position with how we think the text will appear, but we set the
underline attribute (which is relatively rarely used) to make it clearer
that this is synthetic.

For low latency environments (eg: local network) the underline
rarely appears unless you are able to type very quickly.

I've yet to test this on a higher latency link, but think
this is good enough to land and build out so that I can test
that scenario with my work systems.

refs: https://github.com/wez/wezterm/issues/127
2020-03-07 21:53:46 -08:00
Wez Furlong
aae1d5cdb4 mux: set a limit on the line cache
I made this unbounded originally because I wanted to do something
smarter around config reloading.  I'm still too lazy to make it
do that, but do recognize that we should have some limit on the
line cache size, so we just pick the value of the scrollback
size at the time we started.
2020-03-07 20:59:33 -08:00
Wez Furlong
a23699790c CMD-T/CTRL-SHIFT-T: DefaultDomain -> CurrentTabDomain
This used to be effectively the same thing, but now that the launcher
menu allows attaching to other domains, it is best if the hotkey
matches the behavior of the + button on the tab bar and uses the
domain of the current tab instead.
2020-03-07 18:53:45 -08:00
Wez Furlong
70e18c74aa serial: fix a bug where baud rate was not applied 2020-03-07 17:09:43 -08:00
Wez Furlong
e7c61bd62e remove stray debug line! 2020-03-06 09:38:04 -08:00
Wez Furlong
242e386eb7 improve error output in connection ui
* Increase timeout from 2 to 10 seconds, giving you more time to read it
* Make the timeout work even if the UI object is unexpectedly destroyed
* When attaching via the launcher, don't reconnect when the server
  version mismatches the client version.
2020-03-06 09:34:09 -08:00
Wez Furlong
6df260219a mux: improve how we handle EOF on a given tab
This adjusts the mux protocol so that we can tell when a remote tab
has been closed; previously we couldn't distinguish between an IO
error and the tab going away.

Similarly, if the remote mux has shut down (which we detect via an EOF),
then we won't try to reconnect and will proceed to detach that domain.
2020-03-06 08:44:46 -08:00
Wez Furlong
57ab4c8f99 lua: add function to test if we're running in wsl 2020-03-06 07:20:22 -08:00
Wez Furlong
3742071a9b improve OSC 7 / cwd handling when dir doesn't exist
Hadn't noticed this until just now because the systems I've been
using have all had a pretty similar filesystem layout.

This commit avoids a failure to spawn a child process when the
desired directory doesn't exist locally.
2020-03-05 08:07:54 -08:00
Wez Furlong
58310627be launcher: show some domain details
Show the type of mux connection and the destination host alongside
the convenient name from the user's config.
2020-03-03 08:25:11 -08:00