Commit Graph
914 Commits
Author SHA1 Message Date
Wez Furlong 8a74eff72e lineedit: add ctrl-L repaint/refresh binding 2019-05-27 07:14:39 -07:00
Wez Furlong 90fece7b27 fixup windows build 2019-05-26 23:02:50 -07:00
Wez Furlong cd027430db fixup tests 2019-05-26 22:58:38 -07:00
Wez Furlong b1af0cefbd tidy up the line editor interface and docs a bit 2019-05-26 22:52:07 -07:00
Wez Furlong 5dd0e39b05 termwiz: improve line editor
Move the cursor to the correct column when emoji are input.
Add some docs.
2019-05-26 22:39:50 -07:00
Wez Furlong 4fe790dd0c add cursor movement, deletion 2019-05-26 22:04:47 -07:00
Wez Furlong 07910f1d59 disable mouse input in line editor example 2019-05-26 21:20:43 -07:00
Wez Furlong 6d243ec1f1 termwiz: add very basic line editor 2019-05-26 21:10:37 -07:00
Wez Furlong cc0d2e5493 termwiz: fixup key_tester example on macOS
We need to set the terminal to blocking mode when we want poll_input
to block forever, otherwise we immediately receive WouldBlock error
response and quit the program.
2019-05-26 19:01:03 -07:00
Wez Furlong 0bb3714435 improve double-click selection of wrapped lines
This one has been bugging me for a while; we now know when we've
wrapped a line and can join it without a line break when double-clicking
to select a word.

This commit introduces a wrapped attribute to help record this
information, which could potentially help with when it comes
to looking at nicer resize behavior in refs: https://github.com/wez/wezterm/issues/14
2019-05-26 16:05:51 -07:00
Wez Furlong 09f168a0db plumbing for double click selection of wrapped lines 2019-05-26 14:52:03 -07:00
Wez Furlong 038100922a clippy 2019-05-26 12:49:10 -07:00
Wez Furlong 607e180122 Range::contains is now stable; use it. 2019-05-26 11:40:33 -07:00
Wez Furlong e5fe668bbc mention linux package releases in the readme 2019-05-26 11:18:03 -07:00
Wez Furlong bba1d69c13 remove bincode dep 2019-05-26 09:30:34 -07:00
Wez Furlong 3f48387079 fixup mac build for extern crate changes 2019-05-26 09:21:58 -07:00
Wez Furlong e1a1530d22 remove boxfnonce: now require rust 1.35+
Rust can now naturally deal with with these constructs, so drop the
external crate.
2019-05-26 09:14:20 -07:00
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