1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-02 23:55:11 +03:00
Commit Graph

91 Commits

Author SHA1 Message Date
Wez Furlong
43fcca6343 termwiz: ensure that the tty is in blocking mode
Refs: https://github.com/markbt/streampager/issues/1
Refs: https://github.com/markbt/streampager/issues/3
2019-06-02 20:36:01 -07:00
Wez Furlong
c0e3bdfb70 termwiz: avoid emitting a wake event on a spurious pipe wakeup 2019-06-02 18:27:15 -07:00
Wez Furlong
ae303fea56 termwiz: avoid emitting a resize event on a spurious sigwinch read 2019-06-02 18:11:07 -07:00
Wez Furlong
d000938fef emulate poll(2) on macos using select(2)
Refs: https://github.com/wez/wezterm/issues/31
2019-06-02 16:15:17 -07:00
Wez Furlong
090c24554f introduce our own poll function
This is just a minor refactoring at this stage

Refs https://github.com/wez/wezterm/issues/31
2019-06-02 14:53:07 -07:00
Mark Thomas
70741d4f80 set underline and blink in fallback path
pull/29 inadvertently removed the fallback path for setting single
underline and slow blink.  Restore it.
2019-06-02 13:55:07 -07:00
Mark Thomas
3f16979067 clean up flush_pending_attr
The `flush_pending_attr` method does lots of unnecessary comparisons.
If the attributes have changed, then it works by resetting the
attributes and then setting new values.  There's no need to emit the
codes for exiting modes.

It also doesn't support double underscore or rapid blink in the cases
where the terminfo capabilities are used, as these capabilities can't
express these attributes.  Fall back to CSI sequences when these
attributes are requested.
2019-06-02 12:41:46 -07:00
Mark Thomas
90689d4406 set colors after resetting attributes
Changing the terminal attributes (bold, underline, etc.) involves
emitting the `exit_attribute_mode` or SGR reset sequence.  This also
resets the colors back to their defaults.  If this happens when the
foreground or background colors haven't changed, set the colors again.
2019-06-02 12:41:46 -07:00
Wez Furlong
99919dc807 implement answerback for osc 4, 10-18
These codes are used to change the color palette, but if the `?`
string is used in place of a color spec, then we must respond with
the current color value string for that palette entry, so lets
implement that!
2019-06-02 12:19:58 -07:00
Wez Furlong
8f8d03fc05 support osc 10-19 dynamic color changing 2019-06-01 21:47:25 -07:00
Wez Furlong
276e9aef91 osc 4 accepts multiple parameters 2019-06-01 19:59:44 -07:00
Wez Furlong
d18dbe9ff7 parse OSC 4
This code is used to change the color palette at runtime.
We can parse it but not do anything useful with it yet.
2019-06-01 15:39:46 -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
98bd82e212 bump some deps 2019-05-27 20:08:30 -07:00
Wez Furlong
37f451843c termwiz: prep for publishing on crates.io 2019-05-27 19:53:52 -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
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
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
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