1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-22 12:51:31 +03:00
Commit Graph

289 Commits

Author SHA1 Message Date
Wez Furlong
fb1a5b42d2 bump filedescriptor crate 2019-06-01 08:23:23 -07:00
Wez Furlong
906aa0c95c termwiz: use filedescriptor crate instead of RawHandle bits 2019-06-01 07:43:06 -07:00
Wez Furlong
38adc117f4 termwiz: use filedescriptor crate instead of RawFd bits 2019-05-31 22:52:40 -07:00
Wez Furlong
3c6552b975 cargo publish wants a.b.c rather than a.b for package.version 2019-05-27 20:09:33 -07:00
Wez Furlong
98bd82e212 bump some deps 2019-05-27 20:08:30 -07:00
Wez Furlong
91ea7cd576 add keywords 2019-05-27 19:57:44 -07:00
Wez Furlong
37f451843c termwiz: prep for publishing on crates.io 2019-05-27 19:53:52 -07:00
Wez Furlong
3a3755fbe6 moved varbincode to its own repo 2019-05-27 19:44:55 -07:00
Wez Furlong
5976e8d229 lineedit: add tab completion support 2019-05-27 17:39:10 -07:00
Wez Furlong
330c8e8c1f lineedit: add ctrl-d -> EOF 2019-05-27 16:17:49 -07:00
Wez Furlong
a94c802a74 lineedit: add history 2019-05-27 13:35:24 -07:00
Wez Furlong
2b85d5dca4 termwiz: introduce host concept, prompt and coloring
The LineEditorHost trait allows colorizing the line editor.
2019-05-27 12:42:19 -07:00
Wez Furlong
fb5d0464fb lineedit: ctrl-c cancels the current line 2019-05-27 10:29:22 -07:00
Wez Furlong
3e24ef2ea8 cargo fmt 2019-05-27 10:20:33 -07:00
Wez Furlong
0d2bbcfce6 lineedit: add ctrl-w to delete word up to cursor 2019-05-27 09:21:19 -07:00
Wez Furlong
56885e5bad lineedit: add word movement commands 2019-05-27 09:18:36 -07:00
Wez Furlong
0f3869be16 lineedit: implement ctrl-k and fixup deletion of emoji 2019-05-27 08:17:24 -07:00
Wez Furlong
8a44344937 lineedit: split out action and movement concepts
This makes it a bit easier to implement more key bindings and
to make them configurable in the future
2019-05-27 08:02:38 -07:00
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
bba1d69c13 remove bincode dep 2019-05-26 09:30:34 -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
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
df927a84fc add zlib dep for windows builds 2019-03-23 11:30:34 -07:00
Wez Furlong
3777da13d2 fix deprecation warnings 2019-03-22 22:17:54 -07:00
Wez Furlong
222e278720 adopt OneBased type for a number of row/col escape sequences 2019-03-22 20:41:50 -07:00
Wez Furlong
29c7610ead add OneBased helper 2019-03-22 20:41:50 -07:00
Wez Furlong
3003654cc8 fix apt upgrade scrolling issue
This was an off-by-one issue when using scroll margins just shorter
than the screen and when scrollback is enabled.

Added a unit test to verify the behavior.
2019-03-22 20:41:50 -07:00
Wez Furlong
6cbb3ba432 impl IRM insert mode and improve esctest conformance
I've had mixed results with esctest; the IRM and cursor save/restore
tests fail for me in terminal.app, iterm2 and xterm, and fail in the
same way on wezterm, so I'm not sure if I'm not running those tests
correctly.  However, they did encourage the discovery of some other
real issues in the wezterm emulation.
2019-03-22 20:41:50 -07:00
Wez Furlong
6be7c74967 fix rendering of unspecified csi 2019-03-22 20:41:50 -07:00
Wez Furlong
fd2e5855a5 Implement CSI REP 2019-03-22 20:41:50 -07:00
Wez Furlong
2c32eb9337 recognize window management related CSI
These were showing up as unrecognized sequences on my mac, and I
wondered what they were.  We now parse them and do nothing with
them, other than print out the parsed form :)
2019-03-22 20:41:50 -07:00
Wez Furlong
1a883a40e9 use vte with larger OSC buffer support
I wanted to see how much work remains to enable iterm2 image
display; one of the blockers was a limit in the size of the
buffer in the vte crate, which has been removed in my fork
of vte.

As part of testing our ability to absorb that data, I found
a couple of issues with applying the image cells to the display,
so this commit also takes care of that.

We still don't have code to connect the cell image data to the
opengl render layer.
2019-03-22 20:41:50 -07:00
Wez Furlong
fe7502fc0b implement coarse tab data rpc PoC
This required switching away from Rc to Arc so that the data in the
client can transit between threads.

This isn't useful yet.
2019-03-22 20:41:50 -07:00
Wez Furlong
7cdd1876d1 Enable serializing various Line and Cell related structs 2019-03-22 20:41:50 -07:00
Wez Furlong
86ed003428 factor out diff state local vars, add diff_lines method
The intent is to use this together with the terminal emulator;
when running the mux we'd like to use the Surface change stream.
2019-03-22 20:41:50 -07:00
Wez Furlong
ab0c5a8017 whoops, fully undo the half-hearted attempt to address the todo in here
The saturating_sub was going to be an attempt at the look-back alluded
to in the TODO comment, but I decided not to implement that in this
iteration.

The effect of this was that double clicking the `m` in a sequence like
` master` would only select the `m` instead of the `master` string.
2019-02-24 13:17:42 -08:00
Wez Furlong
184befae09 adjust double-click selection class
previously this just used unicode word segmentation rules, but that
is insufficient for most technical users.

Change this to look for sequences that are non-whitespace and not
enclosed by bracket/quote delimiters.  This allows selecting file names
with a double click, which was my main issue.
2019-02-24 13:13:35 -08:00
Wez Furlong
dba88d2102 clippy 2019-02-24 12:01:08 -08:00
Wez Furlong
819bc247a0 micro optimize clearing a line
Turns out to be faster to clear and then resize than it is to
resize down and manually assign the elements
2019-02-22 21:52:18 -08:00
Wez Furlong
a022d3856a micro optimize setting up the storage length
SmallVec::resize showed up as a hot spot in the profiler
2019-02-22 21:14:37 -08:00
Wez Furlong
7e38628486 update termwiz to 2018 edition 2019-02-18 23:26:41 -08:00
Wez Furlong
cd9c6ad5d1 fixup compilation on windows 2019-02-16 00:09:30 -08:00
Wez Furlong
2db17562a6 rustfmt 2019-02-16 00:08:38 -08:00
Wez Furlong
61fec42216 cargo fmt with current stable rustfmt 2018-09-19 20:06:31 -07:00
Wez Furlong
9219dbb327 We can now take iterm images into the wezterm terminalstate
We don't yet have any code to render them, and the vte parser seems
to truncate incoming image sequences ~1kb in size, so more work is
needed to make this useful.
2018-08-08 09:00:07 -07:00
Wez Furlong
a267ebb576 add theoretical support for storing Images in the Surface
There's basic rendering also, but it is not complete.
Needs more tests; will come back to those once more scaffolding
is in place.
2018-08-08 07:07:31 -07:00
Wez Furlong
5d27265b7c add some structs for holding image data 2018-08-06 21:54:17 -07:00
Wez Furlong
2f8ffab213 parse and encode some iTerm specific escape sequences 2018-08-06 01:23:25 -07:00
Wez Furlong
60c24a9e41 consolidate on one set of input keycodes and modifiers 2018-08-05 14:28:29 -07:00
Wez Furlong
cee63e74e1 consolidate term::Line -> termwiz::Line 2018-08-05 12:37:01 -07:00
Wez Furlong
2c7a27c42a move CellCluster to termwiz 2018-08-05 12:10:50 -07:00
Wez Furlong
d7943681de add check for lines with hyperlinks 2018-08-05 09:49:47 -07:00
Wez Furlong
12db6e4629 add implicit hyperlink creation to termwiz 2018-08-05 09:36:29 -07:00
Wez Furlong
18f34545b3 rustfmt 2018-08-05 09:14:40 -07:00
Wez Furlong
e2461b2380 add concept of implicit hyperlink to termwiz
Moves that functionality from wezterm+term into termwiz
2018-08-05 09:13:55 -07:00
Wez Furlong
92f59f243e add state bits to surface::Line
Starting to migrate term::Line functionality over
2018-08-05 08:45:36 -07:00
Wez Furlong
cbe4a2e3bc move surface::Change to its own module 2018-08-05 08:26:06 -07:00
Wez Furlong
e781fdd43b move surface::Line into its own module 2018-08-05 08:25:42 -07:00
Wez Furlong
72d88091bc move surface in preparation for splitting it up 2018-08-05 08:08:39 -07:00
Wez Furlong
8a188cfd74 tweak manifest to point to in-tree termwiz 2018-08-05 08:00:45 -07:00
Wez Furlong
376da31ee4 restructure termwiz tree prior to merging into wezterm repo 2018-08-05 07:55:30 -07:00