1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-01 00:35:46 +03:00
Commit Graph

871 Commits

Author SHA1 Message Date
Wez Furlong
a0f6db85cb tweak color emoji descender handling 2019-10-27 13:44:06 -07:00
Wez Furlong
4116d7d523 remove byte-swapping workaround for opengl
We handle this with a temporary buffer for the upload, which is
a little gross but avoids leaking that implementation aspect
out to the rest of the code.
2019-10-27 10:07:14 -07:00
Wez Furlong
b0438bd533 fix bgra vs rgba for opengl vs software render for iterm2 style images 2019-10-27 00:21:58 -07:00
Wez Furlong
1ea9f305e2 hook up iterm2 style images to the opengl renderer 2019-10-27 00:14:36 -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
0170d1623a clarify vertex indices 2019-10-26 17:39:46 -07:00
Wez Furlong
d4bfdce8c4 DRY with DrawParameters 2019-10-26 17:15:36 -07:00
Wez Furlong
f1172c6272 fix issue where resizing can lead to stair effect
The column count didn't match the pty size col count for some partial
cell width sizes.
2019-10-26 17:11:22 -07:00
Wez Furlong
833d76185f factor quad out of termwindow.rs 2019-10-26 17:02:59 -07:00
Wez Furlong
3ce3399bde move renderstate out of termwindow.rs 2019-10-26 16:59:53 -07:00
Wez Furlong
e69ad44dcb move utilsprites out of termwindow.rs 2019-10-26 16:39:58 -07:00
Wez Furlong
412be60e2e move glyphcache out of termwindow.rs 2019-10-26 16:31:53 -07:00
Wez Furlong
4ce8e1dfc9 remove empty file that was accidentally committed 2019-10-26 16:06:38 -07:00
Wez Furlong
55dd7acad3 remove x11 frontend
It has been superseded by the newer opengl->software frontend
2019-10-26 14:42:27 -07:00
Wez Furlong
4a798d241e fix bottom adjust calculation 2019-10-26 14:09:40 -07:00
Wez Furlong
6692302d1f eliminate a local variable 2019-10-26 13:26:14 -07:00
Wez Furlong
71b4f52e5e clippy 2019-10-26 13:22:16 -07:00
Wez Furlong
9189014fc9 simplify glyph scaling computation 2019-10-26 13:06:52 -07:00
Wez Furlong
702fff7ab7 opengl uses different byteorder than our software renderer
so we need to byte swap depending on whether we are using opengl
or not.
2019-10-26 12:57:20 -07:00
Wez Furlong
c7202af08f fix default frontend on linux when winit is disabled 2019-10-26 12:32:59 -07:00
Wez Furlong
887cbb8e5d factor keyassignment out from winit feature module 2019-10-26 10:25:06 -07:00
Wez Furlong
552368a0cf suppress warnings when enable-winit is not enabled 2019-10-26 10:13:14 -07:00
Wez Furlong
88e97ce5f4 allow disabling winit in the x11 build 2019-10-26 09:56:27 -07:00
Wez Furlong
95d3fb7aeb start making it possible not to build winit+glutin 2019-10-26 09:51:29 -07:00
Wez Furlong
ba56a86201 remove direct gl dependency 2019-10-26 09:33:31 -07:00
Wez Furlong
96911c8d28 move timing logging to debug 2019-10-26 08:39:43 -07:00
Wez Furlong
b318c43bfe add Quad helper to simplify opengl renderer 2019-10-26 08:22:35 -07:00
Wez Furlong
bc4373c3ff implement underlines in the new renderer 2019-10-26 07:50:14 -07:00
Wez Furlong
b9add8e3d4 compute better underlines using font metrics 2019-10-25 23:10:08 -07:00
Wez Furlong
f732f07ddc print gl implementation details when initializing 2019-10-25 21:45:27 -07:00
Wez Furlong
3ca3b3196e clean up process death detection on windows w/ new frontend 2019-10-25 08:26:38 -07:00
Wez Furlong
fc918c2f4d don't panic when minimizing the window on Windows
closes: https://github.com/wez/wezterm/issues/45
2019-10-25 07:20:21 -07:00
Wez Furlong
d81465a39b remove the force-glutin feature 2019-10-24 23:37:05 -07:00
Wez Furlong
7c2afce851 implement EGL based render for termwindow/opengl mode on linux 2019-10-24 17:43:37 -07:00
Wez Furlong
c6ce005b2a make new opengl frontend basically work on macos
It doesn't yet handle underlines or strikethrough.
Notably, live resizing now works, which is nice!
2019-10-24 08:27:11 -07:00
Wez Furlong
bfc09299d8 clippy 2019-10-12 08:51:48 -07:00
Wez Furlong
41e392fc79 we can now init opengl but not render it 2019-10-10 08:15:00 -07:00
Wez Furlong
3779a1a0b1 software: adopt underline sprites for underlines 2019-10-08 22:08:40 -07:00
Wez Furlong
6ac927eab7 add helper for computing underline sprites 2019-10-08 08:56:34 -07:00
Wez Furlong
f0d2068e07 tweak OutOfTextureSpace handling 2019-10-08 08:24:43 -07:00
Wez Furlong
9b1c877b53 begin splitting out software and gl render state 2019-10-08 08:10:38 -07:00
Wez Furlong
3ae1693433 factor out RenderMetrics 2019-10-08 07:37:36 -07:00
Wez Furlong
85c3884ea0 make glyphcache potentially generic over texture type 2019-10-07 08:53:40 -07:00
Wez Furlong
2a19850350 add opengl frontend that sits on top of the window code
This uses the same plumbing as the software frontend, but tries
to enable opengl.

None of the opengl rendering is plumbed through here yet, so this
is currently functionally identical to the software renderer.
2019-10-07 07:51:49 -07:00
Wez Furlong
85311373a5 clippy 2019-10-01 22:20:52 -07:00
Wez Furlong
c0411197fa improve daemonize error messages to show more useful context 2019-09-30 22:28:19 -07:00
Wez Furlong
c6fd88d8c5 add basic simd support for clearing rectangles 2019-09-29 20:24:26 -07:00
Wez Furlong
569408de66 software: handle OutOfTextureSpace condition 2019-09-29 12:42:51 -07:00
Wez Furlong
52a65370fa cargo fmt with rust 1.38 2019-09-28 21:40:40 -07:00
Wez Furlong
d543d07c69 software: remove drop handler 2019-09-28 20:46:31 -07:00
Wez Furlong
ed25cc81e6 fix an issue where closing tab 0 wouldn't repaint the new tab 0 2019-09-28 19:54:37 -07:00
Wez Furlong
7e09492606 Add close operation on macos 2019-09-28 17:46:43 -07:00
Wez Furlong
34f60dfa7f software: add font size key assignment handling
This doesn't know how to resize the window at the moment, which is
different from how the opengl renderer behaves.
2019-09-28 16:00:08 -07:00
Wez Furlong
a3a54837b7 software: implement paste key assignment 2019-09-28 15:50:42 -07:00
Wez Furlong
436bdf7589 software: implement most key assignments 2019-09-28 13:46:17 -07:00
Wez Furlong
a7c4eb430d export key map code from guicommon 2019-09-28 12:54:11 -07:00
Wez Furlong
6dac1a5cf0 software: always render emoji using its own color
This avoids just rendering black when dragging the selection over
the glyph
2019-09-28 10:44:29 -07:00
Wez Furlong
40d7186a9c software: pre-scale emoji so they render more reasonably
Since we don't have a draw-image-and-rescale primitive, and since
we'd have to scale every time we drew the glyph, it makes sense to
cache the pre-scaled glyph in the atlas.
2019-09-28 10:20:17 -07:00
Wez Furlong
389c477b16 software: ligatures now render, but scaled emoji need work 2019-09-28 10:06:47 -07:00
Wez Furlong
2a7892e3c5 software: fill marginal areas outside cell dimensions 2019-09-28 09:19:51 -07:00
Wez Furlong
a9621170f7 window: on macos, query the dpi and improve resize/scaling handling 2019-09-28 09:01:14 -07:00
Wez Furlong
8e38f34b6d fix a couple of warnings 2019-09-22 21:02:02 -07:00
Wez Furlong
2afb2810cc plumb mouse events for software frontend 2019-09-22 13:43:30 -07:00
Wez Furlong
ec280a54f8 incomplete but functional key input for software frontend 2019-09-22 10:25:31 -07:00
Wez Furlong
4de30373b6 tidy up window/tab closing and quitting for software frontend 2019-09-22 08:38:35 -07:00
Wez Furlong
88d15e18af factor our underline/strikethrough metrics for software render 2019-09-22 08:26:54 -07:00
Wez Furlong
ccb27b3422 fixup a few warnings 2019-09-22 08:21:36 -07:00
Wez Furlong
68f81e23f7 software render can now render basic glyphs 2019-09-22 08:12:52 -07:00
Wez Furlong
f17824994f window: add basic timer functionality
We need this to poll the model and invalidate the gui so that it
can repaint as the child process emits output
2019-09-21 22:16:27 -07:00
Wez Furlong
a58a0be632 wire up basic cursor and background color for software render frontend 2019-09-21 17:32:19 -07:00
Wez Furlong
86ba590ead fixup some missing dyn 2019-09-21 13:36:15 -07:00
Wez Furlong
a236cf6c08 fixup for euclid + rect/point/draw_line changes 2019-09-21 13:16:23 -07:00
Wez Furlong
c7c25025ed upgrade euclid dep 2019-09-21 12:32:21 -07:00
Wez Furlong
c19b7db705 fill software window background with black 2019-09-15 19:43:32 -07:00
Wez Furlong
1c8ba615f3 fix build on macos 2019-09-15 19:09:08 -07:00
Wez Furlong
2ace5c7bb4 fixup wezterm compilation for window changes 2019-09-15 19:09:08 -07:00
Wez Furlong
6d23be0164 use Image to generate underline glyphs 2019-09-15 19:09:08 -07:00
Wez Furlong
e98b29aec6 add apply function to safely access inner data 2019-09-15 19:09:08 -07:00
Wez Furlong
0b7556893d bunch of plumbing to allow using new window layer as software rendered frontend 2019-09-15 19:09:08 -07:00
Wez Furlong
cab062118b promise: split execute out to BasicExecutor
This makes it easier to implement just the scheduling portion
without imposing other restrictions on the executor type.
2019-09-15 19:09:08 -07:00
Wez Furlong
e818ad9dd1 pty, wezterm: add support for serial ports
Tested only on windows with a USB serial connector to my NUC running
linux.

This allows opening up wezterm on a serial port connection.
Serial is closer to a tty than a pty, so it is a bit different
to configure and use.

This commit allows running:

```
wezterm serial COM3
```

to open a window that connects to the specified COM port.

You can change the baud rate with:

```
wezterm serial --baud 9600 COM3
```

There are more options that could be set, but I'm a bit lazy and
have only exposed the baud rate to the wezterm cli so far.
2019-08-07 10:59:42 -07:00
Wez Furlong
24f6d90ccf improve error reporting for mux-over-ssh 2019-08-06 18:55:55 -07:00
Wez Furlong
786a4c8551 pty: add concept of "default prog" to the pty layer
Previously we had the logic for this in wezterm itself; it would know
how to figure out which shell to run, or whether we should run a
different program by default (the `default_prog` setting).

This was OK, but when I added support for ssh we hit a conceptual
issue: the local side of the ssh session doesn't have any information
about the shell that should be invoked on the remote side and instead
needs to ask the remote to figure that out.   The interfaces defined
in the code didn't allow for this.

This commit formalizes the concept of a default program and allows
it to be carried through to the pty layer, including over ssh sessions.

Since we now have enough smarts to figure out the local shell and the
local home dir, I've removed the logic that run `login -pf` on macos
by default; this should make the terminal startup very slightly faster
on macos, but since I'm currently on a windows system, I can only test
linux and windows on this side of this commit.  I'll follow up on macos
later.
2019-08-06 15:03:25 -07:00
Wez Furlong
863cf1768a pty: fixup passing term to ssh pty requests 2019-08-06 14:17:03 -07:00
Wez Furlong
567f3c4c0b remove muxed prefix from mux client title bar 2019-08-06 08:33:01 -07:00
Wez Furlong
cd31323c6a use dark mode by default on windows 2019-08-05 18:00:41 -07:00
Wez Furlong
df43d0e0e9 groundwork for re-connecting muxer over ssh
We can't enable this until we grow some smarts about when the disconnect
warrants a reconnection or not.
2019-08-05 13:41:23 -07:00
Wez Furlong
093a0bb541 refactor code that iterates over client domains
More DRY
2019-08-05 12:55:58 -07:00
Wez Furlong
0fed030dac add wezterm connect DOMAIN subcommand for connecting to muxer
This makes it a bit more convenient to control when and which
multiplexer(s) you want to connect to.

Now that each domain must have a name in the configuration file,
we can address them more conveniently from the command line.
2019-08-05 11:39:05 -07:00
Wez Furlong
f9137c0eec allow using domain names in keybindings and Mux lookup 2019-08-05 11:20:28 -07:00
Wez Furlong
5d6bc3882c require all domains to have names 2019-08-05 11:04:56 -07:00
Wez Furlong
af69842fa0 fix parameter order :-/ 2019-08-05 10:49:48 -07:00
Wez Furlong
51c336d94f remove SshDomain.direct_pty
Now that we have `wezterm ssh ...` we don't need this to be in the
configuration.
2019-08-05 09:43:02 -07:00
Wez Furlong
b46dbe60ba use $USERNAME on windows when defaulting ssh user 2019-08-05 09:35:30 -07:00
Wez Furlong
127b2a567b add wezterm ssh user@host some command
This is mostly useful for folks on Windows, as you can also run
`wezterm start ssh user@host some command` to run the `ssh` binary in a
local pty and let it manage your ssh session.

On Windows the local pty currently breaks mouse reporting
(see https://github.com/microsoft/terminal/issues/376) so it is
desirable to avoid using a local pty if we're going to talk to a
remote system.

This commit makes it a bit more convenient to establish an ad-hoc ssh
session with a pty on a remote host.  This method uses libssh2 under the
covers and thus doesn't support gssapi, which is potentially frustrating
for kerberized environments, but works ok for the majority of users.

There are two issues that I want to resolve in follow up work:

* The TERM has to be sent very early in the channel establishment,
  before we "know" the TERM in the `portable-pty` interface.  Will need to
  figure out how to specify that earlier in an appropriate way.
* Similarly, if no command is specified, we should request the use
  of the shell subsystem but we don't have a way to capture this
  intend with the cmdbuilder. Will need to solve this too.
2019-08-05 09:05:54 -07:00
Wez Furlong
c294b4d7a1 allow direct ssh pty
This basically works, but I want to tidy up how we enable this kind
of connection; right now its a bit of a hack.
2019-08-03 12:47:55 -07:00
Wez Furlong
1818cce7f0 factor out ssh connection code 2019-08-03 11:35:44 -07:00
Wez Furlong
3571cd926e cargo fmt fixup 2019-08-02 12:54:18 -07:00
Wez Furlong
5d6f1a5725 adjustments for upstream ssh2 crate changes 2019-08-01 10:26:39 -07:00
Wez Furlong
9d0209d9a5 windows: fix .ssh/known_hosts path 2019-07-30 10:52:10 -07:00
Wez Furlong
dde589af49 fix an issue with pid files when running under wsl
They don't always work, so let's just not use them when under wsl.
Since we now know how to detect when we're running under wsl, we
can use that knowledge to bypass permission checking for the unix
domain sockets automatically too.
2019-07-30 09:45:00 -07:00
Wez Furlong
348575854d Capture terminal errors and show them in a message box
This helps diagnose problems where stderr is not visible.
Let's also capture them to the `log` stream too, and clarify
toml parsing errors, and fix the underlying problem with
ssh_domains not being allowed to be left unspecified.
2019-07-30 08:45:39 -07:00
Wez Furlong
a7722beb0a add support for unix mux via ssh
This adds an ssh domain config type that allows us to ssh to a remote
host and then proxy the unix domain mux protocol over the ssh session.
2019-07-28 16:15:44 -07:00
Wez Furlong
83e1f410e0 remove dead code attribute 2019-07-23 11:11:19 -07:00
Wez Furlong
3d8e4f8b0e fix issue where focusing the window would clear the clipboard
This was particularly noticable on windows.
2019-07-17 08:58:45 -07:00
Wez Furlong
7e50c4db68 workaround conpty drop issue 2019-07-17 08:42:41 -07:00
Wez Furlong
25bb43262d unbreak the default windows pty
I was too focused on the wsl case and didn't test this.  We can't
redirect the process handles without causing some problems with
starting up cmd.exe.   Comment out that portion of the code for
the moment.
2019-07-16 23:04:38 -07:00
Wez Furlong
e2ac4ebb49 remove some stray debug prints 2019-07-16 20:57:43 -07:00
Wez Furlong
48a12da096 capture logs on startup on win32, fixup spawning wsl from gui 2019-07-16 14:14:40 -07:00
Wez Furlong
34ae350d88 allow spawning a server inside wsl 2019-07-16 09:05:35 -07:00
Wez Furlong
8cc5f33600 fix unix domain mux on windows
WSAPoll really doesn't like it if you pass in POLLERR, so don't do that.
2019-07-16 00:29:34 -07:00
Wez Furlong
9370a2d07b improve error logging when failing to daemonize 2019-07-09 09:12:15 -07:00
Wez Furlong
df20277d85 clippy 2019-07-06 08:18:59 -07:00
Wez Furlong
d67d4aab57 avoid marking a tab as dead when we might reconnect it 2019-06-29 16:31:13 -07:00
Wez Furlong
4fc6914602 reduce the amount of RefCell is in server/tab.rs 2019-06-29 16:31:13 -07:00
Wez Furlong
51ead397f6 avoid use of a fork of structopt just for vergen compat
This is much simpler!
Clean up some of the attributes while I'm in here.

refs: https://github.com/TeXitoi/structopt/issues/209
2019-06-27 07:21:59 -07:00
Wez Furlong
285136169e reconnect tls connections automatically 2019-06-26 15:04:53 -07:00
Wez Furlong
96c61fcd53 refactor client to prepare for reconnecting 2019-06-26 15:04:53 -07:00
Wez Furlong
abfd98b7c6 advise the mux when a domain has detached; remove its tabs 2019-06-26 15:04:53 -07:00
Wez Furlong
5c6f44d47f ClientDomain: treat as detached if connection is closed
We detect this when the client thread falls out of its processing
loop.
2019-06-26 15:04:53 -07:00
Wez Furlong
c9489d391b Allow deferred attach of domains
This adds some plumbing so that a domain can indicate whether it is
attached or not, but is not yet smart enough to detect a closed
connection and mark itself as detached.
2019-06-26 15:04:53 -07:00
Wez Furlong
bb04d91101 remove sync_channel, re-fixes large pastes under glium
The sync_channel was originally added as a brake to avoid swamping
the event loop, but we've subsequently grown a more formal rate
limiting config for this.

The rate limiter is superior because it allows making forward
progress over time, whereas the bounded channel is a hard blocking
limit.

When making a large paste the app on the other end will typically
emit a lot of output.  If our reader is blocked on the sync channel
the output of the pty can be blocked, and that in turn will block
our attempt to write to the pty.

We cannot simply set the pty to non-blocking mode because non-blocking
ptys are not a thing on windows, and in the interest of not silently
breaking windows, I prefer to make the unix side of things match
that architecture.

anyway: TL;DR is that we don't need the bounded channel now that
we have rate control to manage swamping the event loop, so we
can simplify this code.
2019-06-24 07:28:40 -07:00
Wez Furlong
4c6768fd2b fixup windows build 2019-06-22 13:40:41 -07:00
Wez Furlong
be345853cd allow spawning the server automatically when connecting via unix domain 2019-06-22 13:22:28 -07:00
Wez Furlong
7751a85826 fix subtraction underflow 2019-06-22 13:14:08 -07:00
Wez Furlong
4c877d493f add --daemonize flag 2019-06-22 12:44:22 -07:00
Wez Furlong
33f17eaf3f remove WEZTERM_SKIP_MUX_SOCK_PERMISSIONS_CHECK env var in favor of config value 2019-06-22 11:01:17 -07:00
Wez Furlong
2e63989c6e add option to avoid connecting to multiplexers on startup 2019-06-22 10:24:45 -07:00
Wez Furlong
83a72d505a clippy 2019-06-22 10:18:23 -07:00
Wez Furlong
6c8d296c44 respect the connect_automatically configuration
For unix and tls clients, if connect_automatically is set
and we're not running the server, then instantiate and connect
to those domains when we start the app.

As part of this I realized that we weren't mapping the remote
tab to the local tab for unilateral pushes, so add some stuff
to support that.
2019-06-22 10:13:02 -07:00
Wez Furlong
9054343e51 factor out tls client configuration
We can now also specify multiple tls clients
2019-06-22 09:08:31 -07:00
Wez Furlong
86251f1787 factor out tls server configuration
Can now specify multiple servers if desired.
2019-06-22 08:44:14 -07:00
Wez Furlong
712089a5de refactor unix domain configuration
It is now possible to specify multiple domains with varying
configuration.
2019-06-22 08:21:25 -07:00
Wez Furlong
fcc2b1ab7d rejigger tab spawning hotkeys
cmd-t now spawns in the same domain as the active tab,
cmd-shift-t spawns in the default domain.

It is possible to define bindings to spawn in an arbitrary domain.
2019-06-22 07:46:49 -07:00
Wez Furlong
2e84714c97 clippy 2019-06-22 07:06:41 -07:00
Wez Furlong
cb4fa1ac21 get_dirty_lines now uses Cow<Line>
This avoids some extra allocations in the local tab case.
2019-06-22 06:57:35 -07:00
Wez Furlong
dc3c5cbdd6 enable url highlighting over mux 2019-06-21 21:40:48 -07:00
Wez Furlong
e12f413224 propagate url clicks back to client 2019-06-21 18:44:07 -07:00
Wez Furlong
1ee4c14474 add size to cli tab list output 2019-06-21 15:04:31 -07:00
Wez Furlong
9978c1234c restructure throttling around scanning and pushing changes 2019-06-21 08:44:10 -07:00
Wez Furlong
cfeb7e4705 remove dead commented out code 2019-06-21 07:58:49 -07:00
Wez Furlong
4ddef39b52 ratelimit unilateral pushes 2019-06-21 07:56:09 -07:00
Wez Furlong
9a4ae0a06b ratelimit child process output
In the early days we relied upon the bounded length of a sync channel
to put back pressure on the output from a child command.  We're no
longer using that kind of channel, so here's a more deliberate and
measurable rate limiting implementation.

The `ratelimit_output_bytes_per_second` configuration setting defaults
to 2MB/s and constrains the amount of text we send to the escape
sequence parser.

This value was selected based on it being a combination of responsive
to ctrl-c while outputing a lot of data and still generating sleeps
to remain within the constraints.

This does mean that terminal benchmarks that test how quickly you
can dump text to the terminal will hit this artifical upper limit
and are thus not going to be a true measure of performance.
2019-06-21 07:16:37 -07:00
Wez Furlong
130a7263d4 avoid repeated emission of cursor updates when scrolled back 2019-06-20 21:39:47 -07:00
Wez Furlong
938eb5e1cf remove old coarse pdus 2019-06-20 21:38:08 -07:00
Wez Furlong
760f9f25de implement peer authentication on the server side
This is admittedly pretty environment-specific, but it matches
an environment that I use :-p
2019-06-20 18:46:31 -07:00
Wez Furlong
16e26797d4 make openssl the default on unix systems 2019-06-20 17:35:20 -07:00
Wez Furlong
4ad7ff3083 use openssl directly for the client when that feature is enabled
This removes some redundancy and overhead around setting up the
connection (the native_tls crate doesn't provide PEM functions,
despite every deployment I've ever seen only ever using PEM certs),
but more importantly, gives the control needed to make hostname
verification work in a PKI setup with unusual CN values.
2019-06-20 17:27:40 -07:00
Wez Furlong
6c9e851ffa make mux server frontend channel unbounded
This avoids the possibility of deadlock if you connect to a remote
host and quickly dump a lot of output to the terminal.
2019-06-20 08:59:26 -07:00