1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-26 14:54:16 +03:00
Commit Graph

947 Commits

Author SHA1 Message Date
Wez Furlong
3cf20acd13 remove the last of the extern crate lines 2019-05-26 09:00:42 -07:00
Wez Furlong
f87901c484 tidy up some failure usage 2019-05-26 08:58:59 -07:00
Wez Furlong
8a76f27f9b remove some extern crates
These got overlooked when migrating from 2015->2018 edition syntax.
2019-05-26 08:27:43 -07:00
Wez Furlong
b83656b378 bump image crate dep
This avoids compiling two different versions of image
2019-05-26 08:13:24 -07:00
Wez Furlong
a05bca460e fixup unused doc comment warning 2019-05-26 07:59:39 -07:00
Wez Furlong
3bf551706e improve pty example
Example output on linux:

```
child status: ExitStatus { successful: true }
output: wez\r\n%
```

Example output on windows:

```
child status: ExitStatus { successful: true }
output: \u{1b}[2J\u{1b}[?25l\u{1b}[m\u{1b}[HDOMAIN\\wez\u{8}\u{1b}]0;C:\\windows\\system32\\whoami.EXE\u{0}\u{7}\u{1b}[?25h
```

Refs: https://github.com/wez/wezterm/issues/27
2019-05-21 08:58:42 -07:00
Wez Furlong
015a97e2be add pty example that runs whoami
Refs: https://github.com/wez/wezterm/issues/27
2019-05-20 07:20:47 -07:00
Wez Furlong
257c864403 flesh out the crate level docs 2019-05-19 22:35:35 -07:00
Wez Furlong
1d8b024f2f add some doc comments to the pty crate
Refs: https://github.com/wez/wezterm/issues/27
2019-05-19 20:31:07 -07:00
Wez Furlong
c562f35db8 adopt my filedescriptor crate in the pty crate
Refs: https://github.com/wez/wezterm/issues/27
2019-05-19 19:54:12 -07:00
Wez Furlong
7464965d1e fixup windows build for pty mod -> crate move
Refs: https://github.com/wez/wezterm/issues/27
2019-05-19 18:55:10 -07:00
Wez Furlong
7bf1d99d77 move pty to its own crate in preparation for publishing
Refs: https://github.com/wez/wezterm/issues/27
2019-05-19 18:40:26 -07:00
Wez Furlong
c207142bcf Improve performance on windows
I noticed that things were feeling laggy in general and when I
added some debugging prints I noticed that we were getting a
continuous stream of CursorMoved events with the same coordinates
while the window had focus.

This diff short circuits mouse processing in that situation and
makes things feel a bit more snappy.
2019-05-18 19:15:04 -07:00
Mark Thomas
5d8860f3dd add terminal wakers
Terminal wakers allow other threads to wake the main terminal processing thread.
2019-05-18 09:12:47 -07:00
Mark Thomas
57983c24de increase renderer buffer size
The default buffer size is tiny (128 bytes), resulting in many calls to tcdrain
during rendering.

Make the buffer a more reasonable 4096 bytes.
2019-05-18 09:12:47 -07:00
Mark Thomas
4ca7214ae2 optimize change to column 0 as CR
Optimize a `Change::CursorPosition { x: Absolute(0), y: Relative(0) }` as CR.
2019-05-18 09:12:47 -07:00
Mark Thomas
6ef1ad3a56 set cursor shape while repainting
When repainting the screen, we must be sure to set the cursor
to the right shape.

While the repaint is happening, hide the cursor to prevent
the cursor jumping around while the repaint happens.
2019-05-18 09:12:47 -07:00
Mark Thomas
a64bf34bb5 make ProbeHintsBuilders from the environment
Extract the code that builds a `ProbeHintsBuilder` from the environment to a
separate `ProbeHintsBuilder` constructor.  This allows callers to re-use the
environment-based `ProbeHintsBuilder`, but override other aspects of
`ProbeHints`, e.g. to disable mouse handling.
2019-05-18 09:12:47 -07:00
Mark Thomas
111f42cf7b join lines with CRLF when fully repainting surface
When repainting a surface, we optimize for the case where lines are simple text
by combining the the `Change::Text` for the end of the previous line and the
start of the next line into a single `Change`.

The assumption about relying on automatic margins is incorrect.  We can't rely
on them, as they might be disabled, and in any case they are no use if the
previous line was shorter than the full width of the screen.

This results in the lines appearing joined together on a single line.  This is
evidenced in the existing tests where `"hel\nw"` becomes `"helw"` on a full
repaint.

The solution is to always inject a real CRLF by adding a `CursorPosition` change.
This replaces any CRLF that may have been swallowed by the `Surface` when it
added the original changes.
2019-05-18 09:12:47 -07:00
Mark Thomas
5d7abfb86a improve windows input event loop
`input_parser.decode_input_records` might not add anything to the input queue,
e.g. if the input event is one that is being ignored.  In this case, we must
loop round and wait again for more input.

Remove the dance for appeasing the borrow checker.  The borrow checker can
be appeased by borrowing the `input_queue` field directly.
2019-05-18 09:12:47 -07:00
Mark Thomas
11b39f76fd backspace usually generates DEL
Despite the name, the backspace key on the keyboard usually generates a DEL
characters ('\x7F'), so DEL should be mapped to backspace.
2019-05-18 09:12:46 -07:00
Mark Thomas
fb636995c8 separate application cursor keys
Application cursor keys are a separate set of encodings that applications can
ask the terminal to produce for cursor keys.

Unfortunately, PuTTY generates these for shift-modified cursor keys.  If an
application is to distinguish between normal and shift-modified cursor keys
on PuTTY then it will need to be able to distinguish between normal and
application cursor keys.

Add new `KeyCode` variants for application cursor keys.
2019-05-18 09:12:46 -07:00
Mark Thomas
83921728ae add key_tester example
Add an example which displays each key that is pressed.  This is useful for
testing what different terminals produce when keys are pressed.
2019-05-18 09:12:46 -07:00
Mark Thomas
6164860a10 add alternate screen support
Add new methods to the `Terminal` trait for entering and exiting the alternate
screen.
2019-05-18 09:12:46 -07:00
Mark Thomas
7c6cf297a6 add scrolling of regions
Add two new `Change` variants: `ScrollRegionUp` and `ScrollRegionDown`, which
scroll part of the screen up or down by a number of lines.

On Unix, these are implemented using the `change_scroll_region` and
`parm_index`/`parm_rindex` terminfo capabilities if available.  If `parm_index`
or `parm_rindex` are not available, but `scroll_forward` or `scroll_reverse`
are, then these are used repeatedly to get the same effect.

On Windows, these are implemented using `ScrollConsoleScreenBuffer`.
2019-05-18 09:12:46 -07:00
Mark Thomas
4e783b3920 make cursor visible when setting shape to default
If the cursor has been made invisible (by setting the shape to `Hidden`),
then in order for it to be visible when it is reset to the default shape,
it must be made visible.  This can be done by rendering the `CursorVisible`
sequence.

Where supported, the `CursorNormal` sequence can be rendered to do
both `CursorVisible` and `ResetCursorStyle` in one go.
2019-05-18 09:12:46 -07:00
Mark Thomas
073f9fb1f8 use AtomicUsize::new(0) instead of ATOMIC_USIZE_INIT
Replace ATOMIC_USIZE_INIT with AtomicUsize::new(0) as the constant has been
deprecated in favour of calling the constructor.
2019-05-05 06:57:32 -07:00
Wez Furlong
67ec001c11 update glium dep; can drop our patch for it now 2019-05-05 06:55:19 -07:00
Wez Furlong
70593c215f Prevent resizing smalling than 1x1
Fixes https://github.com/wez/wezterm/issues/25
2019-05-04 09:18:43 -07:00
Wez Furlong
9646e035df don't self deadlock when processing a lot of eg: resize events
This is fixed by allowing the gui thread to use an unbounded queue
of spawned functions, and keeping non-gui-threads bounded.
2019-05-04 09:07:43 -07:00
Wez Furlong
ebd59f47a3 Revert "add snapcraft build config"
This reverts commit 8dcf3cb21e.

My experience with even getting in the door with snaps was sub-par.
The submission/review process seems under specified and under staffed.

The tools for producing snaps were also rather broken in the case
that your PATH doesn't match a blessed configuration.  This was
hard to discover and expensive to iterate on.

My conclusion is that snaps are not for me.
2019-05-04 08:25:30 -07:00
Wez Furlong
736f617f13 make the window close button kill the current tab 2019-03-25 22:14:19 -07:00
Wez Furlong
52be4c9ba7 remove use-winpty feature flag 2019-03-25 19:46:59 -07:00
Wez Furlong
d040b94b62 add config option to select pty system 2019-03-25 19:35:13 -07:00
Wez Furlong
cac06e5506 rename pty traits, make selectable via enum 2019-03-25 12:06:49 -07:00
Wez Furlong
10165fac32 traitify the pty module 2019-03-25 11:45:52 -07:00
Wez Furlong
eeab341879 add use-winpty feature
When enabled, the windows version will use winpty rather than conpty.
This potentially allows running on older windows versions but has
a few caveats:

* Requires winpty.dll and winpty-agent.exe be in the PATH
* The initial screen / cursor position looks funky for me with the
  latest release of winpty, but that is from a couple of years ago
* Mouse reporting doesn't work, perhaps for the same reasons that
  it isn't working in conpty.

I want to make this into a runtime selectable feature before tidying
up the installation aspects; we need that plumbing anyway to be
able to select between local and remote mux'd tabs.
2019-03-25 09:21:00 -07:00
Wez Furlong
416311892b windows: extract Child 2019-03-25 07:25:43 -07:00
Wez Furlong
7875bc4e1a windows: extract winsize 2019-03-25 07:20:27 -07:00
Wez Furlong
08cb4af6f4 windows: factor out command builder 2019-03-25 07:17:15 -07:00
Wez Furlong
9a9d15f15a pty: restructure to make it easier to share code between conpty, winpty 2019-03-25 07:01:09 -07:00
Wez Furlong
6c6bc43737 move OwnedHandle to its own module 2019-03-25 00:26:37 -07:00
Wez Furlong
4839e94c7e windows: stub out a winpty wrapper
conpty, while it may be the best native API available for consoles
built in to Windows 10, currently swallows mouse escape sequences
(https://github.com/Microsoft/console/issues/376) so we need an
alternative for a better windows experience.

winpty appears to be a reasonably mature pty implementation, so
let's try that!

I tried to use winpty-sys from crates.io but it requires the
installation of an external clang compiler so I used bindgen
on my linux box to convert the small header file to rust and
then tweaked it a bit.

This commit includes that basic wrapper plus a type safe layer
on top.

This will require distributing the dll and an agent helper along
with the wezterm.exe.

This commit doesn't implement the wezterm side of the pty interface;
that will be in a follow up commit.
2019-03-25 00:15:44 -07:00
Wez Furlong
a56f37598c Embed icon into windows executable and titlebar
This also applies to X11 when using the glutin frontend
2019-03-24 19:08:07 -07:00
Wez Furlong
1980e738c7 travis: install fakeroot for deb packaging 2019-03-24 18:23:04 -07:00
Wez Furlong
2667d6a5ed travis: remove platform conditional from deploy 2019-03-24 17:51:28 -07:00
Wez Furlong
cd93f287fd Ask travis to build and publish a .deb to a github release 2019-03-24 17:49:28 -07:00
Wez Furlong
4d8a4f790a fix typo in the readme 2019-03-24 17:04:07 -07:00
Wez Furlong
be0692f52c add links to released packages 2019-03-24 16:57:20 -07:00
Wez Furlong
560087c5e7 appveyor: revise deploy filter 2019-03-24 16:03:48 -07:00