1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-29 16:42:13 +03:00
Commit Graph

1968 Commits

Author SHA1 Message Date
Wez Furlong
ad2f724416 bump some versions 2020-01-09 22:39:34 -08:00
Wez Furlong
9a6a0ffc37 termwiz: fix a bug where the cursor style wasn't restore on exit
`cargo run --example widgets_basic --features widgets` changes the
cursor style but wasn't changing it back when exiting.

In addition, setting the cursor to Default was only restoring visibility
and not restoring the style.
2020-01-09 22:29:11 -08:00
Wez Furlong
561cc856d6 prep termwiz for a new release
Make the widgets portion a feature that can be disabled
2020-01-09 21:52:47 -08:00
Wez Furlong
c8635c07f3 mux: avoid over-invalidating in a couple of cases 2020-01-09 08:47:29 -08:00
Wez Furlong
0f5eec0244 mux: I think I found the invalidation issue
Need to treat None as dirty when looking at the line cache in
get_dirty_lines
2020-01-09 08:07:17 -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
4516036479 reduce debug log level 2020-01-08 23:09:34 -08:00
Wez Furlong
db1d6b3085 remove dead script 2020-01-08 22:16:57 -08:00
Wez Furlong
4391ab5f55 mux:improve management of line cache
There was an issue where we'd get stuck with a placeholder empty
line in a couple of rows when running `ls -l /etc` and scrolling
backwards.  The damage was actually done during execution of the
ls command and was because we'd get confused about the state of
some of the line entries.

This diff introduces a proper state enum for them and defines
state transitions more rigorously.
2020-01-08 22:05:58 -08:00
Wez Furlong
d76e4ed42d use RangeSet for the result of get_dirty_lines 2020-01-08 08:34:22 -08:00
Wez Furlong
cb624173d2 leave it up to get_lines to clear the dirty flag 2020-01-08 07:49:06 -08:00
Wez Furlong
9639d137a7 mux: avoid dirtying a line if it is unchanged on fetch
I noticed the mux was running hot when idle and observed that it was
repeatedly fetching the line with the cursor.

Extract the logic into a helper function that is called from both
of the places that fetch and put lines; noticed that we were not
consistently processing hyperlinks.
2020-01-07 23:01:49 -08:00
Wez Furlong
742689ed42 tweak Fedora install instructions 2020-01-07 22:28:43 -08:00
Wez Furlong
199e873e54 add spawn_task helper function
When running the mux server we don't have an active window::Connection
so we can't use its spawn_task function.  This little helper runs
the futures on the appropriate Tasks instance.

We can't use a trait method for this because traits abhor generic
parameter types.
2020-01-07 20:23:26 -08:00
Wez Furlong
68d460295a improve some rate control in the mux protocol
The client side will limit how many rows it decides to speculatively
prefetch and defer to the lines requested by the renderer once we
exceed a certain number of fetch requests per second.

On the server side, we weren't actually coalescing individual tab
output events together; this commit restructures the end of the
appropriate loop block to make that effective.
2020-01-07 18:04:22 -08:00
Wez Furlong
3fb89d7e02 ensure that domain.attach() is awaited for or waited on 2020-01-07 07:55:22 -08:00
Wez Furlong
a8561a40b2 asyncify the ssh initialization 2020-01-07 07:46:21 -08:00
Wez Furlong
4edc17f157 simply the logic in run_mux_client a bit 2020-01-07 07:30:32 -08:00
Wez Furlong
9c9bf6fb97 add CommandBuilder::from_argv 2020-01-07 07:27:02 -08:00
Wez Furlong
89171cd706 begin async'ifying main.rs 2020-01-07 07:16:41 -08:00
Wez Furlong
41ee87f43c make Domain::attach return a Future
This avoids a hang on startup if you're using an ssh multiplexer
connection and haven't already registered your ssh key and need
to perform password authentication.
2020-01-06 22:41:59 -08:00
Wez Furlong
6a5f203e4b Fix an issue where a config reload would trigger a cascade of reloads
The last config reload time didn't seem to stick in the periodic timer
callback.

Need to investigate that further, and also see if the blink paint
time is similarly impacted.
2020-01-06 14:08:14 -08:00
Wez Furlong
c7aa8cd845 fix some warnings 2020-01-06 11:42:09 -08:00
Wez Furlong
93256f3339 fix lingering after closing down
The root cause of this was a bit of a hack to ensure that we didn't
prematurely shut down while waiting for ssh sessions.

Introduce an Activity token that will extend the lifetime of the
event loop even if there are no windows present.

This cleans things up both on macos the application would linger in
the application switcher until you had tabbed away and back again,
and also for the null frontend which had grown a less gross hack.
2020-01-06 11:37:41 -08:00
Wez Furlong
9670fc3fdf macos: fix minimum scroll wheel tick
macos generates fractional distance values for the mouse wheel,
with one tick starting at 0.1.  We were truncating this to a 0 row
move, which meant that you'd need to build up some acceleration to
move the rows when all you really wanted was a single tick.

This commit changes things so that we round up to at least 1.0 in this
situation.
2020-01-06 10:44:43 -08:00
Wez Furlong
2f6f3ed933 restructure to avoid borrow error
Rust maintains the borrow from the match expression for the lifetime of
the match blocks, even though there is no relationship between the
value in scope in the blocks :-/

Having separate statements makes things happier.
2020-01-06 10:00:46 -08:00
Wez Furlong
57ad948af1 mux: add bonus lines to GetTabRenderChangesResponse
The server now uses this to send the line content for
whichever line the cursor is on, which makes typing
latency better.
2020-01-06 08:36:56 -08:00
Wez Furlong
b384ee4233 make it possible to re-use the line serialization in other pdus 2020-01-06 08:21:12 -08:00
Wez Furlong
0b3af1b7fe add a pdu size histogram to the stats
It tracks the serialized size of the data; here's some stats from a `--release`
build:

```
STAT                                               p50      p75      p95
Key(executor.spawn_delay)                          9.09µs   11.14µs  29.44µs
Key(gui.paint.opengl)                              7.18ms   7.86ms   28.31ms
Key(pdu.decode.compressed.size)                    161      807      2575
Key(pdu.decode.size)                               34       41       45
Key(pdu.encode.size)                               5        6        12
Key(pdu.size, [pdu = GetLinesResponse])            161      807      2575
Key(pdu.size, [pdu = GetLines])                    9        12       16
Key(pdu.size, [pdu = GetTabRenderChangesResponse]) 41       41       47
Key(pdu.size, [pdu = GetTabRenderChanges])         5        5        5
Key(pdu.size, [pdu = ListTabsResponse])            15       15       15
Key(pdu.size, [pdu = ListTabs])                    3        3        3
Key(pdu.size, [pdu = Resize])                      10       11       11
Key(pdu.size, [pdu = SendKeyDown])                 7        8        8
Key(pdu.size, [pdu = UnitResponse])                0        0        0
Key(rpc, [method = get_lines])                     729.09µs 4.06ms   10.16ms
Key(rpc, [method = get_tab_render_changes])        335.87µs 362.50µs 436.22µs
Key(rpc, [method = key_down])                      183.30µs 205.82µs 284.67µs
Key(rpc, [method = list_tabs])                     244.74µs 244.74µs 244.74µs
Key(rpc, [method = resize])                        557.06µs 1.35ms   1.82ms
Key(shape.harfbuzz)                                10.24µs  19.20µs  35.33µs
```
2020-01-06 08:03:29 -08:00
Wez Furlong
f0ea9af97a renumber some pdus to make version mismatch more apparent 2020-01-06 07:54:30 -08:00
Wez Furlong
b0c04c4da0 tidy up proxy path computation 2020-01-06 07:51:50 -08:00
Wez Furlong
0c88894a5a don't assume my own local build paths by default(!) 2020-01-06 07:46:37 -08:00
Wez Furlong
a9a7a9662e ensure that we update fetch_pending in the error case 2020-01-06 07:42:40 -08:00
Wez Furlong
100084d6e5 remove the OpenURL pdu from the codec
Link clicking is handled locally now, so this is not needed.
2020-01-06 07:33:40 -08:00
Wez Furlong
b07babb335 Closing a window closes the window, rather than the tab
refs: https://github.com/wez/wezterm/issues/101
2020-01-06 00:03:01 -08:00
Wez Furlong
8419862f12 track selection per tab again
Selection got accidentally moved to be scoped by window during
the remodel.  This commit moves it to the per tab state.

refs: https://github.com/wez/wezterm/issues/89
2020-01-05 23:23:26 -08:00
Wez Furlong
180a991760 macos: add use_ime option to disable the IME
The IME stuff on macos tends to swallow repeats for some keys.
Ugh.  So this commit adds an option to disable the use of the IME.

Switching away from it effectively inverts the meanging of backspace
and delete (because our method is no longer called by the IME), so
we need to check for that and remap it.  Ugh.

Ugh.
2020-01-05 22:54:59 -08:00
Wez Furlong
94cac23df9 Workaround daemonize bug
refs: https://github.com/knsd/daemonize/pull/39
2020-01-05 20:55:28 -08:00
Wez Furlong
bf910397dd fix error reporting if daemonize fails
This got broken in the move to anyhow
2020-01-05 20:38:53 -08:00
Jun Wu
1c5538976d Make windows::EventHandle Sync
See also https://github.com/wez/wzsh/issues/4.

This makes `WindowsTerminalWaker` Send and unblocks building streampager on Windows.
2020-01-05 19:59:19 -08:00
Jun Wu
6fdae9b226 Make UnixTerminalWaker::wake non-blocking
I was running `hg log --config pager.pager=sp` and pressing space without
releasing it. After about 10k lines sp appears to deadlock. It seems sp uses a
single thread for both reading terminal events and sending wake events and it
sends too many wake events without reading the events.

Failing to write to the wake pipe due to EWOULDBLOCK does not seem to be a
problem - there are enough events in the pipe to wake up the other side.
Therefore let's just make wake_pipe_write nonblocking and treat EWOULDBLOCK as
a success.

Context: The stuck thread looks like:

    #0  0x00007f32671ee237 in write () from /usr/lib/libc.so.6
    #1  0x000055c466022823 in std::sys::unix::fd::FileDesc::write () at src/libstd/sys/unix/fd.rs:96
    #2  std::sys::unix::net::Socket::write () at src/libstd/sys/unix/net.rs:276
    #3  <&std::sys::unix::ext::net::UnixStream as std::io::Write>::write ()
        at src/libstd/sys/unix/ext/net.rs:597
    #4  <std::sys::unix::ext::net::UnixStream as std::io::Write>::write ()
        at src/libstd/sys/unix/ext/net.rs:582
    #5  0x000055c465d010a6 in termwiz::terminal::unix::UnixTerminalWaker::wake (self=0x7ffe6bd32de0)
        at /home/quark/.cargo/git/checkouts/wezterm-6425bab852909cc8/ef1b836/termwiz/src/terminal/unix.rs:278
    #6  0x000055c465a6c64b in streampager::event::EventSender::send_unique (self=0x7ffe6bd32dd0, event=..., 
        unique=0x7ffe6bd32de8) at src/event.rs:66
    #7  0x000055c465a7e65a in streampager::display::start (term=..., term_caps=..., events=..., files=..., 
        error_files=..., progress=..., mode=streampager::config::FullScreenMode::Auto) at src/display.rs:295
    #8  0x000055c465a453a7 in streampager::Pager::run (self=...) at src/lib.rs:171
    #9  0x000055c465a0aced in sp::open_files (args=...) at src/bin/sp/main.rs:170
    #10 0x000055c465a08e4f in sp::main () at src/bin/sp/main.rs:25
2020-01-05 19:26:55 -08:00
Wez Furlong
f38e39134e reinstate scroll to bottom on input behavior
This was temporarily disabled as part of the mux datamodel changes
2020-01-05 18:17:06 -08:00
Wez Furlong
59de97034a belt and suspenders to clip the copy region
a debug assertion triggers for me on macos because we were trying
to copy out of bounds.  This makes the copy routine safe again.
2020-01-05 17:58:14 -08:00
Wez Furlong
fe0b9bde86 fix selection row when viewport is scrolled back 2020-01-05 17:31:45 -08:00
Wez Furlong
ac2c8aadf6 fix an issue where the cursor would appear in the tab bar
If the cursor was in the first non-tab bar row, we'd incorrectly render
it in the same column on both rows.
2020-01-05 16:23:03 -08:00
Wez Furlong
bda0a3b5fe windows: remove DoubleClick from input enums
double clicks weren't registering correctly with the new selection
logic.  Tell windows that we're doing all our own click counting
and simplify the logic.
2020-01-05 16:16:06 -08:00
Wez Furlong
048495b651 Fix x11 compilation due to bad semver bump in xcb-util
Force using xcb-util 0.2.1 precisely because 0.2.2 pulls in a
conflicting major version of xcb (0.8 -> 0.9).

It's a non-trivial upgrade: the types around xkb are different
and features need to be specified in the manifest to enable compilation
of the things that we depend upon.

In addition, xkbdcommon, on which we depend, requires xcb 0.8 and
results in pulling in two conflicting versions of the crates.

It's a bit of a painful situation and will require some effort to
figure out how to upgrade the xcb dependency, when we're ready for that.

refs: https://github.com/meh/rust-xcb-util/issues/12
2020-01-05 15:51:48 -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
c3a58f21cb Add note about mux protocol changes to the changelog 2020-01-05 14:47:46 -08:00