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

266 Commits

Author SHA1 Message Date
Pedro Rittner
579da93ded Support GNUReadline-style Alt-Backspace
Alt-Backspace is the GNUReadline-style shortcut for kill-previous-word.
In wezterm, this currently doesn't work, since this gets trapped by the generic `Backspace` match case.
This diff adds a more specific case for when Backspace is combined with Alt to produce the correct sequence.

This is definitely a hack and there should probably be a more general solution for GNUReadline combinations, but this solves the immediate problem.
2019-11-05 10:33:22 -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
03f51f7be2 macos: fix alt+<ascii> key being passed to terminal
This was an unintended casualty of the recent gui layer refactoring.

If you press `option-h` macos generates DOT ABOVE which we pass through
to the terminal key processing layer.  It sees that ALT is set and emits
an escape byte (to indicate that ALT is set) followed by the UTF-8
sequence for DOT ABOVE.  `zsh` gets confused and treats this as
`<ffffffff>` in its line editor.

This diff restricts the emission of the ESC leader to ascii alphanumeric
characters only.

There needs to be a followup diff to allow configuring how we process
these ALT modified characters on macOS because our current behavior
breaks eg: `ALT-1` which is a hotkey that I use in tmux.  Granted that
I don't need tmux with end to end wezterm, but it does prevent me from
using that if I wanted to.
2019-11-04 18:46:40 -08:00
Wez Furlong
155a972425 add missing selection normalize calls
I saw

```
thread 'main' panicked at 'you forgot to normalize a SelectionRange', term/src/selection.rs:94:9
```
2019-11-03 22:01:35 -08: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
04d6fed848 fixup tests for recent api changes 2019-10-27 09:04:42 -07:00
Wez Furlong
12e71a594a teach the terminalstate about pixel sizes
This allows more accurate slicing of images when processing
iterm2 image sequences
2019-10-26 23:58:39 -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
71b4f52e5e clippy 2019-10-26 13:22:16 -07:00
Wez Furlong
c30ffc2226 prevent terminal from sizing to 0 rows or cols 2019-10-26 12:36:18 -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
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
49894385dd update tests for clipboard changes 2019-06-21 09:12:01 -07:00
Wez Furlong
e993e5a625 allow capturing the clipboard impl from the terminal host
This should allow asynchronous access to the clipboard, which
in turn will allow the server to send the clipboard to the client
unilaterally.
2019-06-20 07:55:03 -07:00
Wez Furlong
764597851c allow collapsing mouse events in the mux protocol
Repeated moves or wheel events are collapsed so that we don't clog up
the queue.  The queue size doesn't matter as much as the latency of
processing a large queue.  For fast or repeated moves the queue can grow
rather quickly, and with what is currently ~25-50 ms round trip per
entry for a remote session, that is a poor UX.
2019-06-16 21:04:53 -07:00
Wez Furlong
302db2c976 a lighter way to pass selection ranges for client tabs 2019-06-16 21:04:53 -07:00
Wez Furlong
d061303bb4 don't forget to copy in the configured color palette! 2019-06-16 14:49:54 -07:00
Wez Furlong
86cd39eb4e we can now send input to a client tab 2019-06-09 16:33:57 -07:00
Wez Furlong
b43c207167 remove defunkt write_all function
This was from a time when we were miusing non-blocking io
2019-06-09 07:36:30 -07:00
Wez Furlong
8055957406 clippy 2019-06-09 07:33:00 -07:00
Wez Furlong
5bf2268292 more log changes 2019-06-08 15:30:47 -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
4193442ec8 make OSC 4 actually change the palette 2019-06-01 16:15:37 -07:00
Wez Furlong
6e4db86f7e add palette to the terminal state 2019-06-01 15:55:08 -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
98bd82e212 bump some deps 2019-05-27 20:08:30 -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
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
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
Wez Furlong
acc895f1cd avoid deadlock while pasting large chunks of text
A big paste could saturate the input/output of the pty and
lead to an effective deadlock; the application wants to send
output to us but we are busy trying to write the paste to it.

Break up large pastes into chunks and send them piece by piece.
This does mean that a large bracketed paste is not an atomic
unit any longer, but it seems to work out ok when pasting into
vim.
2019-03-23 15:25:49 -07:00
Wez Furlong
3777da13d2 fix deprecation warnings 2019-03-22 22:17:54 -07:00
Wez Furlong
fa9bf57e86 fix line feed movement behavior
We were incorrectly treating it as \r\n, but it should only have
been moving vertically.

This fixes the positioning of the cursor when using eg:

`dialog --yesno hello 0 0`

Without this change, the cursor would be way over to the left.
With this change, the cursor is correctly positioned inside
the "YES" box.
2019-03-22 22:14:17 -07:00
Wez Furlong
49467515d6 when erasing the display ensure line size matches physical
In the case where the screen was enlarged, we don't eagerly resize
the line vectors.

If a subsequent erase display occurred, we'd only erase to the old
size of the lines, rather than the new size, which could result
in a black square in the upper right corner of the display.

Repro scenario is:

* resize window larger than initial height
* `dialog --yesno hello 0 0`

The dialog background should fill the display.
2019-03-22 21:59:54 -07:00
Wez Furlong
cbc1462bb4 fix color of erased characters
This was responsible for eg: dialog rendering a black (or whatever
the default background color was) strip behind the text in an
invocation like:

`dialog --yesno hello 0 0`

Rather than render a default cell, render a blank cell using the
current pen.
2019-03-22 21:45:51 -07:00
Wez Furlong
54324121f2 implement basic DEC Line drawing mode
This improves the rendering of eg: `dialog`
2019-03-22 21:28:42 -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
e68bf65b2f clean up some of the newer escape sequence processing 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
9702d1cf5a Add plumbing for running esctest 2019-03-22 20:41:50 -07:00
Wez Furlong
c33bbc8f23 clamp scroll values rather than asserting
I've been looking at https://gitlab.freedesktop.org/terminal-wg/esctest/tree/master
to verify some behaviors and found that it would send out of range
values that would cause wezterm to panic.  Rather than panic, just
clamp.
2019-03-22 20:41:50 -07:00
Wez Furlong
bdfef1fd79 implement Window::ReportTextAreaSizeCells 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
217ad94c80 fixup tests for Rc<Hyperlink> -> Arc<Hyperlink> change 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
e773cff24e adjust tests for pty -> Write changes 2019-03-02 12:29:17 -08:00
Wez Furlong
6c8a9e999e splitting writer out of Tab::pty() 2019-03-02 11:27:11 -08:00
Wez Furlong
0c3410fb6a factor out more of the mouse processing 2019-03-02 09:45:10 -08:00
Wez Furlong
61e7f2d0fe slightly refine some mouse processing code 2019-03-02 09:40:05 -08:00
Wez Furlong
bc15fc4665 split mouse event processing into separate functions 2019-03-02 09:33:58 -08:00
Wez Furlong
5565ccd30e remove host from key_down signature 2019-03-02 09:33:58 -08:00
Wez Furlong
8f13e53ac8 move gui keyboard shortcut processing to guicommon 2019-03-02 09:33:58 -08:00
Wez Furlong
f261f079f7 lift clipboard hotkeys up to gui layer
My original idea was that I would centralize of the key binding
logic in the terminalstate, but this places a bit of a burden on
the TerminalHost portion of the interface.

In particular: when running a multiplexer server we may be headless
or have multiple heads.  In that scenario we want the terminal
to be backed by a virtualized screen, and that means removing
the direct callback to access eg: the host clipboard.  This
diff is the first of a couple that have the goal of removing
those sorts of dependencies.
2019-03-02 09:33:58 -08:00
Wez Furlong
d7b55382b4 big initial mux change
This is an unfortunately large diff that:

* Separates Tab ownership from TerminalWindow
* Introduces a Mux container for all of the tabs in the application,
  across all windows
* Moves ownership of processing pty responses to the mux; it sets
  up and has logic to process data for the ptys and apply to the
  tabs

I've moved the logic for processing new tab and new window hotkeys
to the TerminalWindow's themselves as we need some context to
associate the tab with the right window and to create a new window.

I think that will simplify and allow unifying more code.
2019-02-25 00:03:35 -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
db5aac6681 implement tabs in the glutin gui system
There's a bunch of code duplication that I want to clean up later.
2019-02-23 13:33:32 -08:00
Wez Furlong
5b126b3f1e Restore fullscreen toggle hotkey and fixup for macos 2019-02-23 13:27:59 -08:00
Wez Furlong
b448cfec4d fix shift-insert for paste on linux
the match guard was applying to both arms, so break
this into two separate matches
2019-02-22 20:31:04 -08:00
Wez Furlong
c818225a5d ctrl|cmd +/- to manipulate font size with glutin backend
Simliar code needs to be added to the x11 backend in a follow on
commit.

Refs: https://github.com/wez/wezterm/issues/2
2019-02-22 15:22:31 -08:00
Wez Furlong
42fb687759 more fun with keyboard input with glutin/winit
There isn't really any reliable consistency in the virtual_keycodes
being set for simple keys or shifted keys, so we need to go all in
and add our own scancode processing as a fall back.

This makes it even harder to process unicode input, particularly
because we have no idea whether a ReceivedCharacter event will
follow.
2019-02-20 20:30:19 -08:00
Wez Furlong
9f6b21f0db update term to 2018 edition 2019-02-18 23:20:59 -08:00
Wez Furlong
9c9261f332 fix delete on macos 2019-02-18 03:04:48 -08:00
Wez Furlong
1252eaf153 CMD-V -> paste 2019-02-18 02:47:00 -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
3d3a718182 Fixup phantom release mouse code when using mouse wheel
This was breaking scrolling in vim
2018-09-04 00:34:53 -07:00
Wez Furlong
62d43ddd63 avoid panic when some clients change scroll margins 2018-08-09 00:04:28 -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
2f8ffab213 parse and encode some iTerm specific escape sequences 2018-08-06 01:23:25 -07:00
Wez Furlong
dfa3ef5ae6 fix missing paren for the bell print 2018-08-05 17:22:46 -07:00
Wez Furlong
a8ae14bb6b fix panic when resizing smaller leaves the cursor off screen 2018-08-05 16:32:29 -07:00
Wez Furlong
60c24a9e41 consolidate on one set of input keycodes and modifiers 2018-08-05 14:28:29 -07:00
Wez Furlong
c0ea601645 add helper for managing primary and alt screen 2018-08-05 13:49:03 -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
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
8a188cfd74 tweak manifest to point to in-tree termwiz 2018-08-05 08:00:45 -07:00
Wez Furlong
5482323be5 really fix the erase in display issue
We also need an implicit erase in line in the appropriate direction
2018-08-04 23:23:04 -07:00
Wez Furlong
899593745e fix growing bounds for Line::set_cell 2018-08-04 20:18:02 -07:00
Wez Furlong
e0b6fbfb1f fix off-by-one for EraseInDisplay
We were deleting the current row and below rather than the rows below.
This was the cause of lines going blank during `apt upgrade` runs;
the line just above the bottom would get erased instead of scrolling
up.

I found this by running the termwiz widget demo; the top line was being
erased by mistake.
2018-08-04 19:28:18 -07:00
Wez Furlong
6c1f089f13 buffer processing in Performer::print
This helps to accumulate multi-char grapheme sequences into a single
cell.
2018-08-04 19:02:46 -07:00
Wez Furlong
10f0403973 improve encapsulation of Line struct 2018-08-04 18:33:44 -07:00
Wez Furlong
381e572700 relax some of the dep requirements 2018-08-04 15:35:38 -07:00
Wez Furlong
a597a23aef fix cargo fmt 2018-08-04 14:30:34 -07:00
Wez Furlong
e0cc46fe4f log unhandled cursor shape sequence 2018-08-04 12:43:15 -07:00