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

268 Commits

Author SHA1 Message Date
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
Wez Furlong
204d741be7 improve display for unhandled csi 2018-08-04 11:59:20 -07:00
Wez Furlong
b7a095ef3f Update to use termwiz hosted on github 2018-08-04 09:46:46 -07:00
Wez Furlong
472d243a33 cut over to termwiz Cell 2018-08-04 09:35:39 -07:00
Wez Furlong
1ec83706e7 use termwiz::Hyperlink 2018-08-04 00:26:24 -07:00
Wez Furlong
f37de9cbe5 use termwiz to replace most of the escape parsing 2018-08-03 22:37:04 -07:00
Wez Furlong
039eadc05f update rustfmt 2018-07-11 08:30:49 -07:00
Wez Furlong
8fae5f56a8 remove dead_code marker from some exported constants 2018-07-11 08:14:09 -07:00
Wez Furlong
8b24d34a74 fix panic for large pastes 2018-04-28 21:54:39 -07:00
Wez Furlong
d73892a4fd update for recent rustfmt changes
No functional changes
2018-04-11 13:15:12 -07:00
Wez Furlong
197819db6d Add basic support for ICH which is used by bash CTRL-R 2018-03-09 22:15:06 -08:00
Wez Furlong
ff5a3179e1 new windows with Cmd-N 2018-03-04 17:17:37 -08:00
Wez Furlong
68bb0e859e Show tab number in title bar when there are tabs 2018-03-04 17:06:06 -08:00
Wez Furlong
c5ce3e2621 Add CMD-[0-9] as shortcut for tab switching 2018-03-04 16:52:40 -08:00
Wez Furlong
edf44c9c48 We can now spawn and switch tabs! 2018-03-04 16:46:14 -08:00
Wez Furlong
816925424a add basic tab related key bindings 2018-03-04 13:31:16 -08:00
Wez Furlong
88473e5a09 move window/tab/fullscreen related to TerminalHost 2018-03-04 09:13:36 -08:00
Wez Furlong
5db84856e9 clippy 2018-03-03 13:27:28 -08:00
Wez Furlong
7b7b7cff46 Add support for OSC 52, clipboard
We only allow setting, not reading, the clipboard.
2018-03-01 00:20:15 -08:00
Wez Furlong
80f114c3ee stubs for a couple of OSC sequences
These do nothing, but at least we don't spew about them.
2018-02-28 23:32:30 -08:00
Wez Furlong
28aafa4a73 Improve printing of unknown OSC 2018-02-28 23:09:00 -08:00
Wez Furlong
f986e0c6d8 Properly check the range intersection for invalidating selection 2018-02-28 22:07:48 -08:00
Wez Furlong
f3149a5bf6 Clear the selection rendering when the cells change
I think this covers it... I need to follow up with some test coverage.

Fixes: https://github.com/wez/wezterm/issues/9
2018-02-28 09:06:51 -08:00
Wez Furlong
9ad9360075 Update tab stops when resizing
The issue here was that we were not updating the tab stops when making
the window larger.  This had the side effect of causing the cursor to
move in unexpected ways when tabbing to the right.

Fixes: https://github.com/wez/wezterm/issues/13
2018-02-28 00:15:54 -08:00
Wez Furlong
a274700cb8 figure out what a couple of sequences used by mc are
But don't do anything to implement them yet
2018-02-27 21:33:02 -08:00
Wez Furlong
9d75a42af6 improve debug output for unhandled csi 2018-02-27 21:21:05 -08:00
Wez Furlong
045abeee42 print ding when the bell is rung
refs: https://github.com/wez/wezterm/issues/3
2018-02-27 20:59:09 -08:00
Wez Furlong
27ab1b65a0 Add support for F-keys
Fixes https://github.com/wez/wezterm/issues/11
2018-02-27 08:01:41 -08:00
Wez Furlong
791d39bb4d Fix 256 color palette
We were skewing to blue before red and that didn't match xterm.

Fixes https://github.com/wez/wezterm/issues/12
2018-02-27 07:26:49 -08:00
Wez Furlong
1e71efa33a remove the clunky answerback thing 2018-02-26 08:43:14 -08:00
Wez Furlong
7b5dbab1a4 Do a better job at BCE when erasing lines
The `dialog` program relies on this.
2018-02-26 08:08:05 -08:00
Wez Furlong
8e9620d001 add CHA support, used by dialog 2018-02-26 07:36:32 -08:00
Wez Furlong
4b92a03c15 remove another debug line 2018-02-26 07:15:16 -08:00
Wez Furlong
b81fb73c37 Really avoid underflow with apt scrolling
I thought I took care of this in 7c0536f9a3,
but I misunderstood how saturating_sub works.  I still need to clamp
it within range.
2018-02-24 20:59:44 -08:00
Wez Furlong
4092796db3 Fix an issue where the background color rendered gray instead of black
When using the default monospace font on ubuntu (typicaly
DejaVuSansMono), the texture atlas would end up the bottom left pixel
being a shade of gray.

Since we were using (0,0) coords for whitespace cells, all whitespace
cells would appear shaded gray.

We now reserve a black pixel in the bottom left of the underline texture
and switch to that for whitespace instead.

I added Debug support to the ColorPalette while tracking this down,
and figured that I might as well keep it.
2018-02-24 17:28:35 -08:00
Wez Furlong
9737646978 fix delete 2018-02-24 15:58:38 -08:00
Wez Furlong
abc06620b8 add support for implicit hyperlinks 2018-02-24 15:43:02 -08:00
Wez Furlong
90dd732aee make selected and cursor text fg/bg configurable
Previously we only allowed changing the cursor bg color, now we
get 4 different color settings for this!
2018-02-23 07:57:52 -08:00
Wez Furlong
d03564aa10 paint after each window input, remember mods for text input
Also need to tweak how we handle ALT-x and CTRL-x as the case of the input
is different with glium vs. xcb
2018-02-22 08:41:51 -08:00
Wez Furlong
a7f2757452 rustfmt update 2018-02-20 22:08:19 -08:00
Wez Furlong
7c0536f9a3 avoid panic if an app sets an invalid scroll region 2018-02-20 08:42:08 -08:00
Wez Furlong
279b2018fd Render cursor and selection for resized lines
If the user enlarges the terminal we can have regions of the vertex
buffer that have colors that default to alpha channel 0.  This is
normally fine but breaks rendering of the cursor and the selection;
those attributes are out of band from the normal cell attributes,
especially for whitespace cells, so we need to handle those in
the degenerate case at the end of a line render.

Refactor the code that computes the cursor and selection colors
so that we can call it and use it in both places.
2018-02-19 21:29:27 -08:00
Wez Furlong
25e2dc2a96 fix an issue with the selection when in scrollback 2018-02-19 16:26:10 -08:00
Wez Furlong
dd238d5b50 add DCH 2018-02-19 15:33:13 -08:00
Wez Furlong
d041b7be0d fix an issue with scrolling within a region 2018-02-19 14:39:07 -08:00
Wez Furlong
37e5d8571a add HVP sequence. Just like CUP. 2018-02-19 14:02:54 -08:00
Wez Furlong
c9eba103d1 Use vecdeque for screen lines
This brings us back in the right perf ballpark
2018-02-19 13:08:47 -08:00
Wez Furlong
58f423eebe fix bounds for scrolling
unfortunately this is super expensive and halves the cat test perf.
2018-02-19 11:26:19 -08:00
Wez Furlong
02846f4c82 use Cell::reset to clear portions of a line 2018-02-19 10:51:34 -08:00
Wez Furlong
a0b4630998 micro opt cursor moving during print 2018-02-19 10:47:49 -08:00
Wez Furlong
aa95eaefd9 micro-opt scroll_up some more 2018-02-19 10:27:28 -08:00
Wez Furlong
48997f02d1 micro optimize cell creation 2018-02-19 09:08:17 -08:00
Wez Furlong
1b989b011d improve scroll_up perf
We were marking the entire scrollback history as dirty on each line
scroll.  This was from the early days and isn't needed any more.
This brings the runtime of:

```
$ find /usr > /tmp/usr-files.txt
$ time cat /tmp/usr-files.txt
```

down from ~2.5s to ~1.2s.

Also avoid a redundant line_mut() call in set_cell().
2018-02-19 08:14:03 -08:00
Wez Furlong
563408df6f micro optimization for scroll_up 2018-02-19 07:55:49 -08:00
Wez Furlong
450ed0e82c don't explode when scrolling back 2018-02-18 23:04:11 -08:00
Wez Furlong
fa0549b76e add some more comments
and back out the get_all flag that was added as a temp workaround
in the earlier stages of adding opengl support.
2018-02-18 17:21:02 -08:00
Wez Furlong
de700e0207 make it very slightly cheaper to enumerate the screen lines 2018-02-17 15:04:48 -08:00
Wez Furlong
b8eb6dbedc make color -> uniform conversion more ergonomic 2018-02-17 08:25:59 -08:00
Wez Furlong
c8a58cac06 we now render useless blocks in the fg color via gl 2018-02-16 23:28:51 -08:00
Wez Furlong
20965e786f start hacking on OpenGL ES2 rendering 2018-02-16 21:44:56 -08:00
Wez Furlong
20f4b21f13 add some more tests 2018-02-12 08:25:31 -08:00
Wez Furlong
28179ff981 check negative value for ECH, too 2018-02-12 08:15:35 -08:00
Wez Furlong
438822d63b add ECH handling 2018-02-12 07:57:22 -08:00
Wez Furlong
09f481e753 avoid ambiguous true color csi SGR sequence 2018-02-12 07:40:35 -08:00
Wez Furlong
ad3524bfc8 run down an off-by-one in VPA handling
This manifested with vim-inside-tmux losing my top tmux status line.

Add a test!
2018-02-11 23:56:42 -08:00
Wez Furlong
0870e6c7e4 tweak comments and error printing around OSC 2018-02-11 22:29:21 -08:00
Wez Furlong
6fb12c3520 add test for reverse index 2018-02-11 21:58:53 -08:00
Wez Furlong
18990a24b4 Basic tab stops 2018-02-11 21:54:18 -08:00
Wez Furlong
4c087d32c1 add NEL sequence and test 2018-02-11 20:56:05 -08:00
Wez Furlong
e6fdd4140b add more tests 2018-02-11 20:46:59 -08:00
Wez Furlong
5e49a79705 fix a selection range issue
When dragging a multi-line selection down and to the left, we were
incorrectly setting the computed column range.

Add a test and fix it.
2018-02-11 18:35:58 -08:00
Wez Furlong
2ee0414b66 avoid panic when dragging onto partial rows/columns 2018-02-11 18:09:48 -08:00
Wez Furlong
d0de936f62 add some tests for a double-width selection bug 2018-02-11 17:56:49 -08:00
Wez Furlong
adc11f303a Add some tests for hyperlink parsing and handling 2018-02-11 13:48:51 -08:00
Wez Furlong
ac339f9258 refactor term tests to make it less repeaty 2018-02-11 13:01:36 -08:00
Wez Furlong
21f0e3fd98 Recognize clicks on hyperlinks
There's plumbing for handling these events in the TerminalHost
trait, but we don't do anything beyond printing them at the moment.
2018-02-11 12:28:37 -08:00
Wez Furlong
b6aa2cffea make hyperlinks show underlined on hover
Adds some plumbing to track the current mouse position and
extract the hyperlink from the cell that is being hovered over.

We render those cells with underline, possibly in a different color.

We don't yet do anything on click.
2018-02-11 12:11:02 -08:00
Wez Furlong
1546c2ef0b avoid constructing a vec in the common answerback code path 2018-02-11 09:44:04 -08:00
Wez Furlong
7ad2468937 hide AnswerBack from the public interface
This felt a bit repeatey and it pre-dated the TerminalHost trait.
I'd like to remove it completely but there are some frustrating and
fiddly lifetime concerns with mutable TerminalHost reference so I'm
hiding it from the public interface and bridging it the answerback
stream into the host at the bottom of the advance_bytes method for
now.
2018-02-11 09:40:02 -08:00
Wez Furlong
5a6ed045ad Render underline and double underline 2018-02-10 21:25:43 -08:00
Wez Furlong
ff34198b8a move terminalstate to its own file 2018-02-10 19:14:16 -08:00
Wez Furlong
2329783082 move Terminal to its own file 2018-02-10 19:10:04 -08:00
Wez Furlong
b967bfe3fd move screen to own file 2018-02-10 19:01:44 -08:00
Wez Furlong
604d1c27d7 move line to its own file 2018-02-10 18:55:43 -08:00
Wez Furlong
ddef4e7f7c move cell types to their own file 2018-02-10 18:49:57 -08:00
Wez Furlong
7e7c622b79 move input types to their own file 2018-02-10 18:41:58 -08:00
Wez Furlong
55ae1fb76a move selection types to their own file 2018-02-10 18:41:40 -08:00
Wez Furlong
68949808ba parse and record hyperlinks as cell attributes 2018-02-10 15:45:45 -08:00
Wez Furlong
1500063c96 Start adding hyperlink support code 2018-02-10 15:12:21 -08:00
Wez Furlong
76fe17b20b Cell is no longer Copy
This will support Cells owning `Rc<>` to things like hyperlink
data or image data.
2018-02-10 09:52:14 -08:00
Wez Furlong
629a12a3a0 address a minor todo re: alt screen 2018-02-10 09:50:33 -08:00
Wez Furlong
6b182ffe52 implement an equivalent to xterm*boldColor
I love my tomato bold!
2018-02-10 08:36:34 -08:00
Wez Furlong
3075e47c89 Allow configuring colors 2018-02-10 08:16:20 -08:00
Wez Furlong
7ab462f2bd fixup alt-KEY to send escape rather than set bits 2018-02-09 16:03:09 -08:00
Wez Furlong
d289906dbc Add double click to select a word 2018-02-09 15:47:41 -08:00
Wez Furlong
a28b5f5390 add triple-click to select a line 2018-02-09 08:19:10 -08:00
Wez Furlong
1619f786a9 Add somewhat primitive text selection for copy/paste 2018-02-08 21:35:26 -08:00
Wez Furlong
edd5911535 Add a small font styling engine
This enables selecting an italic font when the cell is italic,
but has more power beyond just that simple property.

This runs a little hot on the CPU so there's probably some caching and
tweaking that can be done to make the evaluation a bit cheaper.
2018-02-07 09:23:24 -08:00
Wez Furlong
532cf28782 add support for setting the primary selection 2018-02-06 20:40:46 -08:00