1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-20 19:27:22 +03:00
Commit Graph

104 Commits

Author SHA1 Message Date
Autumn Lamonte
d100dded23 #133 cleanup + terminalstate-level reverse video mode 2021-07-24 23:36:49 -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
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
a2e882a7cb deps: cargo update, and a couple of dependabot suggestions 2021-07-18 19:10:46 -07:00
Wez Furlong
1f5b900f3d plumb appearance change event -> reload on macos
This commit causes a window-config-reloaded event to trigger
when the appearance (dark/light mode) is changed on macos.

It also arranges to propagate the window level config to newly
spawned panes and tabs, created both via the gui and via the
CLI/mux interface.

refs: https://github.com/wez/wezterm/issues/894
refs: https://github.com/wez/wezterm/issues/806
2021-07-18 00:01:53 -07:00
Wez Furlong
75eaaab6a1 Allow window config overrides to apply per-pane
This allows window-level config overrides to apply
to panes contained within the window.

For instance, this allows setting a window-level
color scheme.
2021-07-17 23:02:41 -07:00
Wez Furlong
f6a7df9678 ssh: avoid looping forever if the connection drops
I saw this in the stderr logs when the connection was offline:

```
 2021-07-17T01:54:28.036Z ERROR wezterm_ssh::session           > Failed to write data to channel: Failure while draining incoming flow. Now
what?
 2021-07-17T01:54:28.036Z ERROR wezterm_ssh::session           > Failed to write data to channel: Failure while draining incoming flow. Now
what?
 2021-07-17T01:54:28.142Z ERROR wezterm_ssh::session           > Failed to write data to channel: Failure while draining incoming flow. Now
what?
```

This commit propagates the error rather than logging and ignoring it.

In addition, remove a couple of sources of blocking or panicking
that are now unmasked by this.

Possibly the root cause of https://github.com/wez/wezterm/issues/857
2021-07-16 19:31:37 -07:00
Wez Furlong
b4c4c85683 changing the active pane now passes the focus event to the terminal
Test scenario is:

* Create a split
* in each pane run: `printf "\e[?1004h" ; od -c`
* Focus the panes, focus another window, and focus the window again
* The I and O events appear in the panes when changing their focus.
* Previously, only the active pane would get focus events when the
  window focus changed.

refs: https://github.com/wez/wezterm/issues/941
2021-07-13 08:58:18 -07:00
Wez Furlong
1bb2f50eb7 fixup windows build 2021-07-11 09:50:50 -07:00
Wez Furlong
edee1335c1 mux: remove parsing bottleneck
Test scenario is `cat`ing the public domain wiki text data from
http://cs.fit.edu/~mmahoney/compression/enwik8.zip in the terminal;
that file is 96M in size.

`time cat ~/Downloads/enwik8.wiki`

Prior to this change, depending on the OS, the time to cat the file
could be several minutes.

Digging in, the bottleneck appears to be that there isn't sufficient
parallelism between the reader and the parser, which means that the
rate of reading data is constrained by how long it takes to parse
and render a frame.

This commit switches away from using a synchronized vecdeque to
effectively create a non-blocking pipe, to "simply" using a socketpair
with a larger buffer size.

We now do blocking pty read -> write to socketpair in the reader
thread, and then read socketpair -> parse in the other.

The key difference between before and after being that the pty read
can continue to read and accumulate data (with an upper bound, so
that CTRL-C is still responsive) while we're parsing and rendering
a frame.

This increases the throughput for this scenario, bringing it down
from ~3:30 to ~17 seconds on this Ryzen 2700X system.

refs: https://github.com/wez/wezterm/issues/927
2021-07-11 08:26:35 -07:00
Wez Furlong
566243ade5 mux: add some metrics around reading from ptys 2021-07-10 21:06:54 -07:00
Wez Furlong
d57bc9b3dc CloseCurrentPane on last pane in a tab results in window closing
The issue is that the pane was only removed from the tab when explicitly
closed, leaving it to be later detected and flushed.

However, in the meantime, when performing eg: cursor blink maintenance,
if the set of panes in the tab is empty then the window would close.

The resolution is to ask the mux (rather than the tab) to kill the pane,
so that the cascading closure of the tab causes the window's active
tab to reference the correct remaining tab.

refs: #890
2021-06-19 11:06:14 -07:00
Wez Furlong
3ea030794b memoize the renderer used for termwiztermtab and custom tab bars
Create only one, then just clone as needed.

refs: #817
2021-06-13 09:06:29 -07:00
Wez Furlong
4feefdd04a cargo update 2021-06-07 08:32:05 -07:00
Wez Furlong
20c4dcdc36 fixup windows build
refs: https://github.com/wez/wezterm/issues/839
2021-05-31 22:39:26 -07:00
Wez Furlong
ab2918d568 restructure async waiting
Expand on the changes in 3f6ff534d3,
this makes them more general and so that they can be used on unix
systems.

That in turn helps to tackle https://github.com/wez/wezterm/issues/839,
wherein `sleep 300 & disown ; exit` would linger until EOF is detected,
rather than triggering as soon as the child process terminated.

For whatever reason, that would only manifest on linux (and not macos).
2021-05-31 22:28:14 -07:00
Wez Furlong
1a44255529 mux client: connect all mux panes in window to clipboard when attaching
refs: https://github.com/wez/wezterm/issues/836
2021-05-31 08:40:19 -07:00
Wez Furlong
5359f39dcf mux: fix an issue where auth window would linger before closing
Same vein as 8931afba5cee07ab12990f06c2ff34d6f8426b19; the auth
window could sometimes get stuck until an input event was sent
to it.

Wire up a mux event so that the window can close itself.
2021-05-31 00:11:47 -07:00
Wez Furlong
87cb593554 mux: client would prune out the empty window when connecting via ssh/tls domain
When the client connected to an empty remote mux, it would allocate an
empty window and then spawn a new tab into it.

Meanwhile, the authentication window would close and trigger a prune of
all empty windows, causing the in-flight spawn to fail because its
destination window was removed.

This commit defers window pruning while Activity is in progress;
the MuxWindowBuilder has an associated Activity count.
2021-05-30 23:50:13 -07:00
Wez Furlong
529b709277 windows: ssh: detect resizes during authentication
refs: https://github.com/wez/wezterm/issues/696
2021-05-29 15:15:42 -07:00
Wez Furlong
eaa0d2f4d3 ssh: fix lost character after keyboard auth on windows
closes: https://github.com/wez/wezterm/issues/771
2021-05-29 10:05:55 -07:00
Wez Furlong
257d323062 fixup laggy mux connections for recent idle changes
in the same vein as d657721163
this commit introduces more assertive signalling from the remote
mux when a pane is closed so that the client can update.
2021-05-29 00:16:27 -07:00
Wez Furlong
d657721163 fix lingering ssh connections
Similar to 3f6ff534d3, we need to
tickle the mux to detect when the session terminates.

In this case we can relatively simply schedule an async wait without
spawning an additional thread.
2021-05-28 22:16:31 -07:00
Wez Furlong
0b1b30c73a fix a build warning 2021-05-28 17:51:03 -07:00
Wez Furlong
3f6ff534d3 windows: fix lingering cmd.exe panes
Since removing the regular periodic background tasks, we're now
prone to not noticing child processes exiting.

This commit explicictly schedules a thread to do that on Windows
so that we can close a tab as soon as it exits.
2021-05-28 15:11:29 -07:00
Wez Furlong
f78190ec9c filedescriptor: remove anyhow from public interface
Use thiserror instead
2021-05-23 14:24:01 -07:00
Wez Furlong
78424036f9 mux: reduce kill/wait period for fish
This kill/wait was added to workaround fish being weird on macos.
This is accidentally exponential as the pty layer already loops,
so we don't need to also loop here.

refs: https://github.com/wez/wezterm/issues/774
2021-05-21 23:33:51 -07:00
Wez Furlong
db45238769 improve exit_behavior messaging
The status information now explains the exit status and the
exit_behavior, as well as links to the docs on exit_behavior.

refs: https://github.com/wez/wezterm/issues/795
2021-05-15 08:32:29 -07:00
Wez Furlong
ed6987298a mux: remove window invalidation polling
Add a mux event for this insteead.

refs: https://github.com/wez/wezterm/issues/770
2021-05-08 11:25:03 -07:00
Wez Furlong
1cbaf55640 change mux empty poll to mux empty event
As part of reducing the amount of regularly scheduled stuff wezterm
does in the background, this commit restructures how an empty mux
is detected; now when the mux prunes dead windows it will emit
an Empty event.

The Activity type will now schedule a prune when it is dropped,
which will clean up and trigger the Empty event.

refs: https://github.com/wez/wezterm/issues/770
2021-05-08 10:25:49 -07:00
Wez Furlong
09f0421b48 add lua repl to the debug overlay
`wezterm` is pre-imported.
The repl prints the result of the expressions to the overlay.

refs: https://github.com/wez/wezterm/issues/641
2021-05-03 09:19:44 -07:00
Wez Furlong
7a86f1b2b8 fixup word selection on long lines
This got a bit broken by the fix for https://github.com/wez/wezterm/issues/714

since we can be handed a range of logical line fragments, we should
test each of them to find our matching result.

Also, improve the logic for constraining the length when looking
backwards.
2021-05-02 12:40:16 -07:00
Wez Furlong
94c98aa826 quickselect: fixup edge case with wrapped lines
the binary search would falsely extend the end of the match
to the start of the subsequent match for the wrapped line case.

The resolution is to emit a coordinate for the newline that we
add to the haystack between the wrapped lines.

closes: https://github.com/wez/wezterm/issues/732
2021-04-29 17:15:49 -07:00
Wez Furlong
8ce376753f round out quick select mode
* Make alphabet and patterns configurable
* add docs
* Enhance scrollback search to support regex captures so that
  searching for eg: `fo(o)` will select the last `o` in `foo`.

refs: https://github.com/wez/wezterm/issues/732
2021-04-25 16:27:39 -07:00
Wez Furlong
87677a73bf Add support for iTerm2's SetUserVar escape
This doesn't propagate across wezterm's mux protocol
at this time.

refs: https://github.com/wez/wezterm/issues/647

https://iterm2.com/documentation-scripting-fundamentals.html#setting-user-defined-variables
2021-04-25 14:30:06 -07:00
Wez Furlong
053cb11e9f improve ssh domain support for ssh_config
This tidies up how we pass the ssh config to the connection ui
logic, by moving the ssh_config setup to the two callers.

A couple of notable adjustments:

* SshDomain::username is now optional; it will default to the
  values computed by the ssh config file loader
* no_agent_auth value wasn't hooked up to anything, but now it is

refs: https://github.com/wez/wezterm/issues/730
2021-04-24 21:56:32 -07:00
Wez Furlong
52b57ca512 fix splitting panes while a pane is zoomed
closes: https://github.com/wez/wezterm/issues/723
2021-04-23 22:32:47 -07:00
Wez Furlong
d6cfa9c610 fix a possible panic when word-selecting off the top of viewport
refs: https://github.com/wez/wezterm/issues/713
2021-04-23 19:10:26 -07:00
Wez Furlong
384b5cb6be avoid pathological line wrapping situations
refs: https://github.com/wez/wezterm/issues/714
2021-04-23 18:14:53 -07:00
Dian M Fay
7ae05b5333 conditionally include process divination for quit-confirm check on any win/linux/osx instead of all 2021-04-22 23:08:53 -07:00
Wez Furlong
adbe545d44 fix window vanishing when a tab is closed
We weren't fixing up the active tab position correctly after removing
a tab.  I think this bug crept in around the ActivateLastTab changes.

We now try harder to set active idx back to the tab that was active
prior to the remove, and ensure that we set the active index to
something within range if it was the active tab that was removed.

Refs: https://github.com/wez/wezterm/issues/690
2021-04-13 08:18:52 -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
Wez Furlong
dfb6043971 fix potential panic when pasting multibyte text > 1024 bytes
We were handling the case where the chunk intersected a multibyte
boundary after the first chunk, but not for the first chunk itself.

Refactor the code so that we use the same chunk splitting logic
for both of those cases.

refs: https://github.com/wez/wezterm/issues/668
2021-04-09 11:47:42 -07:00
Wez Furlong
ecc500af05 ssh: don't override the ssh config User value 2021-04-08 16:17:49 -07:00
Wez Furlong
5509c0af69 fix Pane::get_lines_with_hyperlinks_applied
This function could return 1 more line than was requested in the case
where resizing had caused long lines to rewrap.

That extra line would cause the partial bottom row of the quads to
populated with bogus data and rendered over the top of the background
fill.

The resolution is to stop populating lines once we've reached the
upper bound based on the input range.

refs: https://github.com/wez/wezterm/issues/605
2021-04-02 19:56:11 -07:00
Wez Furlong
4a3e0615f5 tweak ActivateLastTab and add a changelog entry for it
refs: https://github.com/wez/wezterm/pull/610
2021-04-02 09:29:52 -07:00
Alex Gartrell
ee4b4b598c Add ActivateLastTab command
This replicates `last-window` in tmux. To pull this off, I
deliberately store the last tab whenever I'm activating a new one or
spawning a new one. I had to do this explicitly rather than hooking
set_active, because we end up setting the active tab briefly for some
common operations like moving a tab.
2021-04-02 09:14:59 -07:00
Wez Furlong
a3d4b4c722 tidy up unused config field 2021-03-28 18:26:51 -07:00
Wez Furlong
369888c94e wezterm-client: cut over to new wezterm-ssh bits
refs: https://github.com/wez/wezterm/issues/507
2021-03-28 07:18:38 -07:00
Wez Furlong
be5c255f1b remove dead code 2021-03-28 07:11:31 -07:00