1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-20 19:27:22 +03:00
Commit Graph

258 Commits

Author SHA1 Message Date
Wez Furlong
82261ff16d wezterm: enable scrollback in the error window
This commit doesn't do anything specific to scrollback though!
It moves the implementation of the TermWizTermTab away from
a directly manipulated Surface and over to using the term::Terminal,
making the renderer look more like the one used by the local tab
and domain implementation.

As a side effect of doing this, we get scrollback management
for free.

refs: https://github.com/wez/wezterm/issues/201
2020-06-03 08:45:03 -07:00
Wez Furlong
ccf9fc141b wezterm: fixup DECKPAM/DECANM/DECCKM interaction
We were treating DECCKM as the sole thing to enable application
cursor reporting, but looking closely at the docs, that mode only
takes effect when both DECANM (Vt52 emulation mode) AND DECKPAM
(application keypad mode) are both active.

neovim enables DECCKM and DECKPAM but not DECANM.

refs: https://github.com/wez/wezterm/issues/203
2020-05-31 15:45:25 -07:00
Wez Furlong
92fdf043b8 termwiz: fix panic in RgbColor::from_rgb_str w/ empty string
Need to check the len before looking at the first character!

closes https://github.com/wez/wezterm/issues/198
2020-05-29 07:15:45 -07:00
Wez Furlong
58686f925f termwiz: fix a widget layout and optimization issue
This commit adds a simple example of nested widgets, which uncovered
an issue with respecting the layout positioning, and adds a secondary
screen buffer to make the widget render cycle more optimal:

```
cargo run --example widgets_nested --features widgets --release
```

refs: https://github.com/wez/wezterm/issues/171
2020-05-18 07:40:09 -07:00
Wez Furlong
77fafd512b termwiz: add example program that strips escape sequences 2020-05-17 21:30:12 -07:00
Wez Furlong
1ad6f00696 termwiz: cut 0.9.0 release 2020-05-17 12:05:46 -07:00
Wez Furlong
3349ef0dca termwiz: fix categorization of F keys
refs: https://github.com/wez/wezterm/issues/178
2020-05-16 17:25:23 -07:00
Wez Furlong
f2b12c64ba termwiz: use long form ST when rendering OSC
Neovim doesn't like using BEL as an alternative for ST when
parsing the OSC dynamic color responses.

Use the longer form sequence to make it happier!
2020-05-16 11:01:26 -07:00
Wez Furlong
a3921a73fa Explicitly ignore focus tracking (dec private mode 1004)
We still don't support it, but we no longer log that we don't
know what the mode is.
2020-05-16 09:31:02 -07:00
Wez Furlong
a1c0cabf18 term: process OSC 110+: ResetDynamicColors
neovim uses these
2020-05-16 09:25:17 -07:00
Wez Furlong
132529cfd5 support Terminal identification sequence
This reports the TERM_PROGRAM and TERM_PROGRAM_VERSION
separated by a space.

See discussion in https://github.com/mintty/mintty/issues/881
with a more concise description of the functionality here in
this VTE issue: https://gitlab.gnome.org/GNOME/vte/-/issues/235

```bash
$ printf '\033[>q'; cat
^[P>|WezTerm 20200503-171512-b13ef15f-4-g0395639a^[\
```
2020-05-03 22:10:38 -07:00
Wez Furlong
fa32457656 cargo fmt 2020-05-02 17:39:45 -07:00
Wez Furlong
b3a57f0d1c termwiz: line editor: fix a couple of bugs
* ctrl-R to find a line and then hit enter would cause the search
  text rather than the match text to be returned and run!
* When exiting the editor, clear to end of screen to make sure
  that we clean up any UI from the incremental search status
2020-04-10 21:10:42 -07:00
Wez Furlong
d4df39f793 termwiz: line editor: add ChangeSequence helper
This helps us keep track of the extent and cursor position that
we render for the line editor, making it easier to make the editor
rendering more fancy.
2020-04-10 20:42:02 -07:00
Wez Furlong
8963fb76aa termwiz: line editor: add incremental history search 2020-04-10 11:02:59 -07:00
Wez Furlong
79007d9c33 termwiz: line editor: allow custom editor actions
This restructures the LineEditor to allow the hosting application to
override key presses and apply custom edits to the editor buffer.

Methods for performing predefined actions and for accessing the line
buffer and cursor position have been provided/exposed to support this.

One consequence of this change is that the editor instance needs to be
passed through to the host trait impl and that means that the LineEditor
can no longer be generic over `Terminal`.  Instead we now take `&mut dyn
Terminal` which was how the majority of non-example code was using it in
any case.  This simplifies a bit of boilerplate in wezterm but adds an
extra line to the most basic examples.
2020-04-09 07:37:23 -07:00
Wez Furlong
eb1f583e2b termwiz: line editor: allow embedded app to override key map 2020-04-09 06:40:29 -07:00
Wez Furlong
e033e3576f termwiz: History::get() -> Option<Cow<str>>
The BasicHistory impl returned a borrowed reference but the sqlite based
impl I'm adding to wzsh needs to own it.
2020-04-08 22:32:14 -07:00
Wez Furlong
af339f7cfe termwiz: line editor: allow application cursor keys
On Windows, if you run `wsl.exe` from the terminal and start zsh
(maybe bash also?) and it enables application cursor key mode,
exiting zsh doesn't clear application cursor key mode and when we
return to the shell and are using virtual terminal input rather
than the native windows console input, we'll continue to receive
application cursor key sequences instead of regular cursor key
input sequences.

This commit recognizes both flavors as arrow movement
in the line editor to make this feel less broken.
2020-04-08 19:11:15 -07:00
Wez Furlong
5b57f5f9ff termwiz: line editor: exit completion state for a single completion result 2020-04-08 10:07:15 -07:00
Wez Furlong
11c7e29b59 termwiz: windows: toggle autonewline when toggling cooked/raw
Without this, `wzsh` will keep the terminal in raw mode between
line editor invocations, resulting in staggered/stairway output
for any spawned commands.
2020-04-08 08:57:26 -07:00
Wez Furlong
db845db55b termwiz: line editor: allow for multi-line prompts 2020-04-07 22:06:05 -07:00
Wez Furlong
5b700e4d5d wezterm: recognize MS terminal mode 25 for cursor visibility 2020-04-06 13:19:44 -07:00
Wez Furlong
d98fee9e0b termwiz: windows: allow ESC to be recognized again
After processing a batch of input records, we need to effectively
flush any pending ambiguous sequences in order to register a lone
ESC key press.
2020-04-06 10:13:49 -07:00
Wez Furlong
b279bb68e0 termwiz: windows: auto-detect virtual terminal support
With the revised native windows console renderer using the various
console APIs more deeply, I've seen a couple of cases where those
API calls fail inside eg: wezterm running via the new pty machinery.

Using the virtual terminal APIs and the terminfo renderer is the
right thing to do in that case.

This commit probes for virtual terminal support and uses the builtin
xterm terminfo, unless the environment has
`TERMWIZ_BYPASS_VIRTUAL_TERMINAL=1` set.  This allows forcing the
use of the windows console layer.
2020-04-06 09:51:15 -07:00
Wez Furlong
92fa32695c termwiz: windows: fixup viewport handling
Some windows APIs have inclusive dimensions and some exclusive;
we were off by one for the height of the display which led to some
weirdness with eg: `sp` and the line editor.

When it comes to scrolling: if the scroll request is for the entire
viewport then we simply adjust the viewport; this is desirable because
it allows data to scroll back into the history in the native console.
2020-04-06 09:33:52 -07:00
Wez Furlong
290bc5567e termwiz: windows: tidy up flushing a bit 2020-04-06 07:52:56 -07:00
Wez Furlong
03ab5ea659 termwiz: windows: fix bounds check for cursor positioning 2020-04-05 21:00:54 -07:00
Wez Furlong
58c07b6da0 termwiz: line editor: fixup cursor positioning for multiline
This fixes the math around cursor positioning for the edge case where
the width of text and the cursor position are close to the width of
the terminal.
2020-04-05 20:46:41 -07:00
Wez Furlong
96880a08b4 termwiz: improve performance of windows console renderer
This reduces flickering updates in the native windows console;
it works by taking a copy of the screen buffer, applying the
Change's to that buffer and then copying back to the console.
2020-04-05 19:15:48 -07:00
Wez Furlong
fe89082764 termwiz: remove Position::NoChange, fixup multiline line editing and moar!
This is unfortunately a bit of a muddy commit and I'm too lazy to split
it up.

* Removed `Position::NoChange`; use `Position::Relative(0)` instead
* Added missing cursor positioning cases in the terminfo renderer
* Taught line editor about the cursor position when the line spans
  multiple physical lines
* Taught the Windows input layer to process escape sequences for eg:
  the arrow keys when running with virtual terminal enabled.
* Removed the hack that under-reported the terminal width; the hack
  was present to make some aspects of rendering with the native windows
  console logic easier, but it was getting in the way of the line
  editor.  This may well break something, but it fixed up the line
  editor :-/

cc: @markbt
2020-04-05 11:14:08 -07:00
Wez Furlong
6d5a7ad143 termwiz: ensure virtual terminal processing is enabled on windows
I'm not sure if this is strictly needed as it seems to be the default
for the ways that I interact with windows (via wezterm and via ssh).
2020-04-04 18:02:47 -07:00
Wez Furlong
aaf3a7fcaf termwiz: allow using terminfo on Windows
This commit changes the behavior on Windows:

* If $TERM is set and the `terminfo` crate is able to
  successfully initialize and locate a terminfo database (this also
  requires that $TERMINFO be set in the environment), then we'll
  use the `TerminfoRenderer` instead of the `WindowsConsoleRenderer`
* If $TERM is set to `xterm-256color` and no terminfo database was
  found, use our modern compiled-in copy (look in the `termwiz/data/`
  directory for the source and compiled version of this) and use
  the `TerminfoRenderer`.
* Otherwise use the `WindowsConsoleRenderer`.

In practice, this allows termwiz apps to opt in to features such as
true color support on Windows 10 build 1903 an later by setting their
`TERM=xterm-256color`.   This happens to be the default behavior when
`ssh`ing in to a windows host via `wezterm`.

You can see the truecolor mode get applied by running this example:

```
cargo run --example widgets_basic --features widgets
```

with TERM set as above the background region that is painted by the app
will be a blueish/purplish color, but with it unset or set to something
invalid, it will fall back to black.

I'd like to eventually make termwiz assume the equivalent configuration
to `TERM=xterm-256color` by default on Windows 10 build 1903 and later,
but it's worth getting some feedback on how this works for clients such
as `streampager`.

cc: @quark-zju and @markbt
2020-04-04 17:52:53 -07:00
Wez Furlong
fb6d0bbc7c termwiz: windows: fix default text foreground color
We were defaulting to bright white for `CellAttributes::default()`
rather than standard grey.

heads up @quark-zju and @markbt
2020-04-04 13:52:20 -07:00
Thom Chiovoloni
cfc22c1fcb Update comment based on review feedback 2020-03-13 21:05:43 -07:00
Thom Chiovoloni
0874b03d65 Add support for more more sequences to the input parser's keymap 2020-03-13 21:05:43 -07:00
Wez Furlong
65749f06a3 mux: fix poll interval. show update indicator
Add an update indicator to the top right of client tabs; this is
overlaid on top of the surface when the last update from the server was
more than ~3s ago and if we expected it sooner than that.

While making this work, I noticed that the exponential poll backoff
had gotten broken in an earlier refactor; instead of a series of polls
backing off slowly, we were aggressively running the backoff up to the
max 30 second interval over the span of a few ms.   This commit fixes
up the backoff computation to only happen when we are ready to send
a poll.

refs: https://github.com/wez/wezterm/issues/127
2020-02-23 09:08:04 -08:00
Wez Furlong
3dea5a59fc termwiz: bump version for publish
heads up to @quark-zju
2020-02-22 07:40:06 -08:00
Jun Wu
4651b4c703 termwiz: bump regex to 1.0+
This makes termwiz (likely) use the same regex when being compiled
together with other dependencies in the eco-system.
2020-02-11 07:45:50 -08:00
Jun Wu
ca2e9c013a termwiz: do not depend on derive_builder
derive_builder has some extra dependencies that take a while to compile.
The builder feature can be expressed via a 30-line macro. So let's do
that to make termwiz compile faster.
2020-02-11 07:45:50 -08:00
Jun Wu
f51650c891 termwiz: remove dep on palette
The palette crate has a codegen step that translates svg_colors.txt to named.rs.
That makes it hard to build using buck.

Remove the palette dependency so termwiz is easier to build using buck.

I made sure the following code:

    fn main() {
        use termwiz::color::RgbColor;
        let r = RgbColor::from_rgb_str("#02abcd").unwrap();
        let r1 = r.to_tuple_rgba();
        let r2 = r.to_linear_tuple_rgba();
        println!("r1 = {:?}", r1);
        println!("r2 = {:?}", r2);
    }

prints

    r1 = (0.007843138, 0.67058825, 0.8039216, 1.0)
    r2 = (0.000607054, 0.4072403, 0.6104956, 1.0)

before and after the change.
2020-02-11 07:45:50 -08:00
Wez Furlong
8f3a233773 Remove dep on palette for resolving color names
Embed rgb.txt and parse it on the fly to produce the list of colors.
This list is a superset of palette's SVG color list.

refs: https://github.com/wez/wezterm/pull/144
2020-02-07 08:58:53 -08:00
Wez Furlong
152aa85e82 Add links to some docs on a couple of terminal mode codes 2020-01-26 19:14:05 -08:00
Wez Furlong
f3e42c3d2a point to local filedescriptor crate 2020-01-26 09:15:24 -08:00
Wez Furlong
ee70ec3ae0 Add support for OSC 104 (ResetColors) 2020-01-26 08:26:01 -08:00
Wez Furlong
3bc30d2d47 accept rgb:XX/XX/XX color syntax for OSC 4
The `vis` editor uses that syntax to apply its color schemes.

refs: https://github.com/wez/wezterm/issues/134
2020-01-26 07:37:08 -08:00
Wez Furlong
9d63d30fc0 vttest: make the E's show up on the cursor positioning test
Refs: https://github.com/wez/wezterm/issues/133
2020-01-25 20:20:31 -08:00
Wez Furlong
7aa0994b0f termwiz: lineedit: replace a println with render/flush
The terminal may not be attached to stdout, so the println isn't
appropriate.
2020-01-20 07:55:51 -08:00
Wez Furlong
51545ab099 termwiz: windows: normalize SHIFT+ASCII
This makes the input behavior consistent with posix: if SHIFT is held
and a letter key is pressed, make sure that we treat that as the ascii
uppercase version of that key and that the SHIFT modifier is cleared.
2020-01-17 16:56:29 -08:00
Wez Furlong
9ec4694d89 migrate some more code to the newer spawn mechanism 2020-01-16 09:15:07 -08:00
Wez Furlong
256b4e6da8 fix pollable_channel to be non-blocking on Windows
Upgrade filedescriptor to 0.7 to use the portable helper for
setting non-blocking mode, and enable non-blocking mode on Windows.
2020-01-15 21:30:14 -08:00
Wez Furlong
16c8957728 termwiz: fixup test case for 18bbd2ac6f 2020-01-14 22:09:33 -08:00
Wez Furlong
18bbd2ac6f termwiz: fixup input parser to match backspace/delete
With the changes in f0e94084d1 I
noticed that backspace and delete were inverted here in termwiz.

This diff adjusts the input parser to match.
2020-01-13 23:31:51 -08:00
Wez Furlong
da0185fee5 fix an issue where we'd scroll to the bottom when a modifier was pressed
This is irritating when switching tabs via keyboard shortcuts
2020-01-12 11:58:24 -08:00
Jeremy Fitzhardinge
b53412d0cb Track current working dir via OSC 2020-01-11 18:25:17 -08:00
Wez Furlong
b5124bfbdd set the dirty bit when joining rewrapped lines 2020-01-11 00:24:05 -08:00
Wez Furlong
e6b4aa835a re-wrap lines when resizing
Adds logic to resize handling that will consider the original logical
line length when the width of the terminal is changed.

The intent is that this will cause the text to be re-flowed as if it had
been printed into the terminal at the new width.  Lines that were
wrapped due to hittin the margin will be un-wrapped and made into a
single logical line, and then split into chunks of the new width.

This can cause new lines to be generated in the scrollback when
making the terminal narrower.  To avoid losing the top of the buffer
in that case, the rewrapping logic will prune blank lines off the
bottom.

This is a pretty simplistic brute force algorithm: each of the lines
will be visited and split, and for large scrollback buffers this could
be relatively costly with a busy live resize.  We don't have much choice
in the current implementation.

refs: https://github.com/wez/wezterm/issues/14
2020-01-11 00:10:25 -08:00
Wez Furlong
ad2f724416 bump some versions 2020-01-09 22:39:34 -08:00
Wez Furlong
9a6a0ffc37 termwiz: fix a bug where the cursor style wasn't restore on exit
`cargo run --example widgets_basic --features widgets` changes the
cursor style but wasn't changing it back when exiting.

In addition, setting the cursor to Default was only restoring visibility
and not restoring the style.
2020-01-09 22:29:11 -08:00
Wez Furlong
561cc856d6 prep termwiz for a new release
Make the widgets portion a feature that can be disabled
2020-01-09 21:52:47 -08:00
Jun Wu
1c5538976d Make windows::EventHandle Sync
See also https://github.com/wez/wzsh/issues/4.

This makes `WindowsTerminalWaker` Send and unblocks building streampager on Windows.
2020-01-05 19:59:19 -08:00
Jun Wu
6fdae9b226 Make UnixTerminalWaker::wake non-blocking
I was running `hg log --config pager.pager=sp` and pressing space without
releasing it. After about 10k lines sp appears to deadlock. It seems sp uses a
single thread for both reading terminal events and sending wake events and it
sends too many wake events without reading the events.

Failing to write to the wake pipe due to EWOULDBLOCK does not seem to be a
problem - there are enough events in the pipe to wake up the other side.
Therefore let's just make wake_pipe_write nonblocking and treat EWOULDBLOCK as
a success.

Context: The stuck thread looks like:

    #0  0x00007f32671ee237 in write () from /usr/lib/libc.so.6
    #1  0x000055c466022823 in std::sys::unix::fd::FileDesc::write () at src/libstd/sys/unix/fd.rs:96
    #2  std::sys::unix::net::Socket::write () at src/libstd/sys/unix/net.rs:276
    #3  <&std::sys::unix::ext::net::UnixStream as std::io::Write>::write ()
        at src/libstd/sys/unix/ext/net.rs:597
    #4  <std::sys::unix::ext::net::UnixStream as std::io::Write>::write ()
        at src/libstd/sys/unix/ext/net.rs:582
    #5  0x000055c465d010a6 in termwiz::terminal::unix::UnixTerminalWaker::wake (self=0x7ffe6bd32de0)
        at /home/quark/.cargo/git/checkouts/wezterm-6425bab852909cc8/ef1b836/termwiz/src/terminal/unix.rs:278
    #6  0x000055c465a6c64b in streampager::event::EventSender::send_unique (self=0x7ffe6bd32dd0, event=..., 
        unique=0x7ffe6bd32de8) at src/event.rs:66
    #7  0x000055c465a7e65a in streampager::display::start (term=..., term_caps=..., events=..., files=..., 
        error_files=..., progress=..., mode=streampager::config::FullScreenMode::Auto) at src/display.rs:295
    #8  0x000055c465a453a7 in streampager::Pager::run (self=...) at src/lib.rs:171
    #9  0x000055c465a0aced in sp::open_files (args=...) at src/bin/sp/main.rs:170
    #10 0x000055c465a08e4f in sp::main () at src/bin/sp/main.rs:25
2020-01-05 19:26:55 -08:00
Wez Furlong
624c7234e4 Improve serializing hyperlinks in lines for the mux
This is both a little more efficient on the wire and results in
hovering over hyperlinks working as you would expect in the mux.
2020-01-05 14:37:17 -08:00
Wez Furlong
12b537d2c8 serde_derive -> serde with derive feature 2020-01-05 14:37:17 -08:00
Jun Wu
318267c88b Fix negative cursor movement
I noticed moving-up does not work and tracked it down here.
2020-01-05 14:18:08 -08:00
Jun Wu
ef1b836441 Drop unnecessary mut from WindowsTerminalWaker::wake
This matches `UnixTerminalWaker`.
2020-01-04 14:04:56 -08:00
Jun Wu
0ac59cb44c Remove unused dependency
Detected by `cargo-udeps`.

I was wondering why @markbt/streampager requires `jpeg-decoder`.
2020-01-03 22:55:05 -08:00
Jeremy Fitzhardinge
887991f464 Remove BlockOutline cursor style
Not really needed, since its something we can handle at rendering time.
2019-12-29 16:58:15 -08:00
Jeremy Fitzhardinge
6d5fbf93ff Define outline cursor for unfocused use 2019-12-29 16:58:15 -08:00
Wez Furlong
8135ce46a5 Blink the cursor when it is set to blink
The blink rate is configurable via a new option.

Refs: https://github.com/wez/wezterm/issues/7
2019-12-22 10:08:31 -08:00
Wez Furlong
5abc4e543e rendering now respects cursor visibility
This commit adds some plumbing for describing the cursor shape
(block, line, blinking etc) and visibility, and feeds that through
the mux and render layers.

The renderer now knows to omit the cursor when it is not visible.
2019-12-22 08:52:51 -08:00
Wez Furlong
f493139305 clippy 2019-12-21 23:13:26 -08:00
Wez Furlong
662227a725 bump vtparse version for publishing 2019-12-21 16:43:13 -08:00
Wez Furlong
4fdee2baf0 maybe fix the windows build for anyhow changes 2019-12-14 22:27:37 -08:00
Wez Furlong
9a2c7a1485 failure -> anyhow + thiserror 2019-12-14 21:43:05 -08:00
Wez Furlong
7c7825c070 term: extract configuration to a trait
This isn't complete but begins the process of extracting
the embedding application configuration into a trait provided
by the application rather than passing the values in at
construction.

This allows the application to change configuration at
runtime.

The first option to handle this is the scrollback size.
2019-11-24 12:43:41 -08:00
Wez Furlong
ac7a509dbb allow configuring the tab bar
The defaults are pretty neutral.  You can get a little more fancy
with something like this:

```
[colors.tab_bar]
background = "#0b0022"

[colors.tab_bar.active_tab]
bg_color = "#2b2042"
fg_color = "#c0c0c0"

[colors.tab_bar.inactive_tab]
bg_color = "#1b1032"
fg_color = "#808080"

[colors.tab_bar.inactive_tab_hover]
bg_color = "#3b3052"
fg_color = "#909090"
italic = true
```
2019-11-21 00:04:49 -08:00
Wez Furlong
d397976acf fix rendering of the cursor position in the line editor 2019-11-16 13:58:01 -08:00
Wez Furlong
6289c08a4e Adopt CSI u modifier encoding for keypresses
See http://www.leonerd.org.uk/hacks/fixterms/ for the specification.

Refs: https://github.com/wez/wezterm/issues/63
2019-11-16 13:38:03 -08:00
Wez Furlong
7323e30be7 try to normalize the shift state in the keymap handling code
We weren't recognizing ctrl+shift+c for example on linux.
2019-11-11 09:11:52 -08:00
Wez Furlong
a26cab3833 add wezterm imgcat subcommand to output images to the terminal
This subcommand parses its input and outputs an iTerm2 compatible
img escape sequence (https://iterm2.com/documentation-images.html)

Usage is straightforward:

```
$ wezterm imgcat  assets/windows/terminal.ico --width "10%" --height "10%"
```
2019-11-09 15:50:59 -08:00
Wez Furlong
6da7b3ecd0 internalized password/auth UI for ssh
This is a bit of a large commit because it needed some plumbing:

* Change mux creation to allow deferring associating any domains,
  and to change the default domain later in the lifetime of the
  program
* De-bounce the empty mux detection to allow for transient windows
  during early startup
* Implement a bridge between the termwiz client Surface and the
  frontend gui renderer so that we can render from termwiz to
  the gui.
* Adjust the line editor logic so that the highlight_line method
  can change the length of the output.  This enables replacing
  the input text with placeholders so that we can obscure password
  input
2019-11-08 19:55:12 -08:00
Wez Furlong
1ab438c1e2 improve emoji width calculation
I noticed while scrolling `emoji-test.txt` that some of the combined
emoji sequences rendered very poorly.  This was due to the unicode
width being reported as up to 4 in some cases.

Digging into it, I discovered that the unicode width crate uses a
standard calculation that doesn't take emoji combination sequences
into account (see https://github.com/unicode-rs/unicode-width/issues/4).

This commit takes a dep on the xi-unicode crate as a lightweight way
to gain access to emoji tables and test whether a given grapheme is
part of a combining sequence of emoji.
2019-11-05 08:45:08 -08:00
Wez Furlong
a9bdca6d84 bump up to latest unicode segmentation crate 2019-11-04 22:12:21 -08:00
Wez Furlong
23b4876d75 fix an issue with utf-8 in OSC sequences
I've noticed this off and on for a while, and thought it was something
fishy with my shell dotfiles.

Tracing through I found that the final byte in the "Face with head
bandage" emoji 🤕 U+1F915 was being interpreted as the MW control
code and causing the vt parser to jump out of the OSC state.

The solution for this is to hook up proper UTF-8 processing in the
same way that it is applied in the ground state.

Since we don't have enough bits to introduce new state values (we're
pretty tightly packed in the 16 bits available), I've introduced a
memory of the state to which the utf8 parser needs to return once
a complete sequence is detected.
2019-11-03 22:01:35 -08:00
Wez Furlong
c3d8f26e3e fix test case
refs: https://github.com/wez/wezterm/issues/52
2019-10-28 00:14:19 -07:00
Wez Furlong
d80169ceff Avoid accidental application mode delete output in key processing
I thought that I'd broken something with the DEL processing in vim with
the new frontend but it turned out that the other frontend was emitting
BS always and that I'd actuall unbroken passing DEL through and that
other layers were translating DEL into an application cursor mode output
for DEL that emits a totally different sequence.

This diff preserves DEL and disables that other sequence.

Will follow up with some explicit configuration to control this
behavior, but in the short term, the default behavior should be much
closer to what people actually want and expect!

refs: https://github.com/wez/wezterm/issues/52
2019-10-27 23:59:15 -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
52a65370fa cargo fmt with rust 1.38 2019-09-28 21:40:40 -07:00
Wez Furlong
950a7d2b22 cargo fix dyn 2019-09-28 20:29:48 -07:00
Wez Furlong
23e174a324 fully bump filedescriptor dep 2019-07-23 09:50:48 -07:00
Wez Furlong
6ace6d4fcc avoid a panic when resizing a muxed tab as the first event 2019-07-16 09:34:51 -07:00
Wez Furlong
d18383416e termwiz: update version
This pulls in the new vtparse crate and publishes Mark's new
API in the termwiz parser.
2019-06-29 19:20:11 -07:00
Wez Furlong
5440cbe521 replace vte with our own vtparse crate
This enables using large OSC buffers in a form that we can publish
to crates.io without blocking on an external crate.  Large OSC
buffers are important both for some tunnelling use cases and for
eg: iTerm2 image protocol handling.
2019-06-29 16:28:39 -07:00
Wez Furlong
2361d88c2a initial take on a low level vt parser
This is based on the state machine described by
https://vt100.net/emu/dec_ansi_parser

and the public domain C implementation:
https://github.com/haberman/vtparse
2019-06-29 15:21:09 -07:00
Mark Thomas
dbb0bd565e add parse_first_as_vec
Add a convenience function to the escape parser that, like `parse_first`,
matches only the first escape sequence, but instead collects all matching
actions.
2019-06-25 06:44:30 -07:00
Wez Furlong
2c7138cc6e use consistent version of filedescriptor crate 2019-06-22 14:31:19 -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
97daa8b246 switch to using the poll stuff from filedescriptor 0.3 2019-06-19 00:01:35 -07:00
Wez Furlong
b58d329b07 some plumbing to use Surface+Change for the mux protocol 2019-06-16 21:04:53 -07:00