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

75 Commits

Author SHA1 Message Date
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
Wez Furlong
c966dbae96 fixup win32 build 2021-03-27 21:04:21 -07:00
Wez Furlong
26923eefd6 allow splits when using ssh 2021-03-27 18:24:34 -07:00
Wez Furlong
e103653923 RemoteSshDomain now uses wezterm-ssh crate
There are a few notable changes as a result:

* A number of `.ssh/config` options are now respected; host matching
  and aliasing and identity file are the main things
* The authentication prompt is inline in the window, rather than
  popping up a separate authentication window

Refs: https://github.com/wez/wezterm/issues/457
2021-03-27 18:12:34 -07:00
Wez Furlong
c6308202cb hyperlinks, selection by word and line deal with wrapping better
These now operate in terms of logical lines so they deal with
lines that have wrapped outside the viewport better than in
previous releases.

closes: https://github.com/wez/wezterm/issues/408
2021-03-26 14:52:00 -07:00
Wez Furlong
d827be990d speculatively apply hyperlinks to logical lines
This might be all that is needed to make multiline implicit hyperlinks
function, but I need to transfer this commit to another machine to try
it.

refs: https://github.com/wez/wezterm/issues/527
refs: https://github.com/wez/wezterm/issues/408
2021-03-26 13:47:27 -07:00
Wez Furlong
57b0911504 add Pane::get_logical_lines
refs: https://github.com/wez/wezterm/issues/527
refs: https://github.com/wez/wezterm/issues/408
2021-03-26 13:18:44 -07:00
Wez Furlong
cdae65238a ssh2: on windows, link against openssl
The wincng based build doesn't recognize newer keys which makes it
impossible to connect to a reasonably up to date Fedora installation.

This commit points to my branch of ssh2-rs that has some changes to
build ssh2 against the vendored openssl that is already part of
the dependency graph for wezterm.

refs: https://github.com/wez/wezterm/issues/507
2021-03-26 10:00:43 -07:00
Wez Furlong
317077123f mux: adjust error logs down to warn + info
Unhandled unknown sequences aren't errors per-se
2021-03-23 08:16:32 -07:00
Wez Furlong
d350709d2f maybe fix build on freebsd 2021-03-22 22:14:55 -07:00
Wez Furlong
6ea24e7516 fixup build on win32 2021-03-22 21:57:00 -07:00
Wez Furlong
3cf7c9c3c2 refine skip_close_confirmation_for_processes_named to look at proc tree
That means that we won't be fooled by a shell with a backgrounded
editor.

refs: https://github.com/wez/wezterm/issues/562
2021-03-22 21:34:10 -07:00
Wez Furlong
e69485d3ca avoid hang if several glyphs fail to resolve in quick succession
The channel to the connui was bounded to 16 and could easily be
saturated from the main thread.  The saturated queue would block
the main thread.
2021-03-22 15:53:56 -07:00
Wez Furlong
4d4fa35557 skip_close_confirmation_for_processes_named now also works on macos
refs: https://github.com/wez/wezterm/issues/562
2021-03-22 12:57:36 -07:00
Wez Furlong
ad4b3b4648 add skip_close_confirmation_for_processes_named option
Currently only respected on linux.

refs: https://github.com/wez/wezterm/issues/562
2021-03-22 12:42:46 -07:00
Wez Furlong
d62d2a5133 avoid blocking forever in LocalPane::drop
I don't understand how fish ends up blocking forever in the related
issue, but it shouldn't block us too!  The price of this situation
is likely a lingering zombie child process but that seems fine.

refs: https://github.com/wez/wezterm/issues/558
2021-03-20 12:16:56 -07:00
Wez Furlong
9e6abce963 mux: adjust pty output buffering/reading
I've had a few people comment that the screen repaints stutter
more since the most recent release.

One of the main changes in that area was to increase throughput
for timg case, where a lot of data was being pumped through.

I think that, ironically, the decreased latency results in more
frequent repaints where not all of the updated screen is visible
in a full screen redraw, so it appears more janky.

This commit introduces a small 1ms delay to see if additional
output is forthcoming when parsing the data.  It will keep
delaying and accumulating until there's at least one parsed
output action to process, so there is a small constant latency
overhead added to a single character output (thread context
switch + 1ms delay).

This small delay is counter-balanced with raising the priority
of dispatching the render actions; previously we'd spawn them
at lower-than-input priority.  With the batching potential,
I think spawning them at the same priority is OK; the main
reason for the lower priority was to ensure timely ctrl-c
processing when a lot of output is being dumped to the terminal.

It's hard for me to gauge whether this fixes the reported issue,
as I've been unable to reproduce it for myself.

refs: https://github.com/wez/wezterm/issues/559
refs: https://github.com/wez/wezterm/issues/546
2021-03-19 22:12:29 -07:00
Wez Furlong
ba7add140e Attach gui window invalidation to pty output event
I'm not convinced that this is 100% good, but @fanzeyi reported
some latency when using tmux to mirror two sessions.  The session
that was accepting interactive input responded quickly, but the
mirroring session was laggy.

This change connects the mux pane output event to window invalidation,
which should cause repaints to happen more often.

I couldn't reproduce the scenario above on my M1 mac, but that may
just be because M1 has dark magicks.
2021-03-17 20:20:08 -07:00
Wez Furlong
2ea093170c mux: avoid panic if prune_dead_windows is called indirectly
refs: #542
2021-03-15 06:38:17 -07:00
Wez Furlong
693a717db2 improve output parsing performance and throughput
I've been meaning to do this for a while; this commit moves
the escape sequence parsing into the thread that reads the
pty output which achieves two goals:

* Large escape sequences (eg: image protocols) that span multiple
  4k buffers can be processed without ping-ponging between the
  reader thread and the main gui thread
* That parsing can happen in the reader thread, keeping the gui
  thread more responsive.

These changes free up the CPU during intensive operations such
as timg video playback.

This is a slight layering violation, in that this processing
really belongs to local pane (or any pane that embeds Terminal),
rather than generically at the Mux layer, but it's not any
worse a violation than `advance_bytes` already was.

refs: https://github.com/wez/wezterm/issues/537
2021-03-13 19:19:05 -08:00
Wez Furlong
5fa5aef7f3 Disable newline splitting in output processing
In a couple of quick tests, this doesn't seem to break cat'ing
the emoji test data so it seems like it isn't needed anymore.

In addition, it removes a bottleneck from processing image
streams produced by timg, which tend to be very large with
new newlines.

With this change, I'm able to view a 25fps source video at
about 60fps.

refs: https://github.com/wez/wezterm/issues/537
2021-03-13 14:23:36 -08:00
Wez Furlong
823213703c mux: introduce can_close_without_prompting concept to model
This is defined as a trait method on Pane (default: false), and has the
obvious transitive equivalent methods in Tab and Window (eg: if all
contained items are `can_close_without_prompting`, then that container
is also `can_close_without_prompting`).

The intent is to avoid bothering the user to confirm closing a window
when the content is not stateful and doesn't warrant it.

For example: the window that is displayed in the event of a
configuration error really shouldn't prompt to the user to confirm
closing it.

All termwiztermtab panes are `can_close_without_prompting==true`
to effect this policy.

In the future, we could teach LocalPane to lookup the session leader
process against a list of "uninteresting" or "stateless" processes
and return an appropriate result (as suggested in
https://github.com/wez/wezterm/issues/280).  That functionality
is NOT part of this commit.
2021-02-27 09:03:13 -08:00
Wez Furlong
697a6abd04 add exit_behavior config option
`exit_behavior = "Hold"` will keep the pane alive until explicitly
closed.  More details in the docs that are part of this commit.

refs: https://github.com/wez/wezterm/issues/499
2021-02-27 00:15:51 -08:00
Wez Furlong
651e536d87 term: plumb Bell through toast notification channel
Per my comment: https://github.com/wez/wezterm/issues/3#issuecomment-780750798

this routes the bell through to the GUI layer, where it currently
does nothing about it.
2021-02-18 22:34:05 -08:00
Wez Furlong
83da7216c3 toast: hook notifications up to OSC 9
refs: #489
2021-02-17 09:33:58 -08:00
Dylan Frankland
88f44f5b5f
Add erase mode to ClearScrollback action (#439)
* Add ClearBuffer action

Clears all lines, both visible and those scrolled off the top of the viewport, making the prompt line the new first line and resetting the scrollbar thumb to the full height of the window.

This is the behavior that Hyper / xterm has for clearing the terminal.

* Combine ClearBuffer into ClearScrollback as enum with associated erase mode

Makes it easier to manage the different options of clearing the terminal.
2021-01-25 21:26:23 -08:00
Wez Furlong
28e527b649 fix tests
refs: #429
2021-01-17 22:01:21 -08:00
Wez Furlong
da3a41e018 wezterm: fix mapping scroll wheel to cursor up/down in alt screen
This appears to have been broken since the introduction of mouse
assignments :-/

This commit adds Pane::is_alt_screen_active so that the gui layer
can tell whether the alt screen is active, and allow passing down
the event.

refs: #429
2021-01-17 21:44:02 -08:00
Wez Furlong
5d360ae365 termwiz: Remove anyhow::Result from public API
It's been replaced with an opaque termwiz error type instead.

This is a bit of a more conservative approach than that in (refs: #407)
and has less of an impact on the surrounding code, which appeals to
me from a maintenance perspective.

refs: #406
refs: #407
2021-01-08 00:32:30 -08:00
Wez Furlong
7cf68365a5 deps: misc updates 2020-12-29 09:24:34 -08:00