Commit Graph

30 Commits

Author SHA1 Message Date
Joe Wilm dc918ae71a Rustup and clippy
All of the changes in this commit are due to clippy lints.
2016-12-16 22:13:51 -08:00
Joe Wilm 4e9a307bed Fix a couple of compiler warnings 2016-12-12 09:31:29 -08:00
Joe Wilm 4b63bddd55 Track terminal cells on mouse movement
The cell under the cursor is now tracked in the input processor at
`self.mouse.line` and `self.mouse.column`. This could probably be
optimized to only compute the cell when in certain states, but the
calculation is cheap.
2016-12-11 22:02:03 -08:00
Joe Wilm 3d26d3c68a Implement mouse scrolling with line deltas
This makes scrolling work for mouse wheels (was previously just
trackpads).
2016-12-11 20:23:41 -08:00
Joe Wilm ff5081d5e5 Add support for bracketed paste
Binding/Action execute now has access to TermMode to support bracketed
paste mode.
2016-12-11 20:23:41 -08:00
Joe Wilm adf02b5049 Support trackpad scrolling
Linebased scrolling is still unsupported (need a mouse to test with).
2016-12-11 20:23:41 -08:00
Joe Wilm 90e0a759e8 Support normal mouse tracking mode
This allows the user for eg clicking columnts in htop to sort.
2016-12-11 20:23:41 -08:00
Joe Wilm 66dbd29cd1 Add support for recording/running ref tests
Ref tests use a recording of the terminal protocol and a serialization
of the grid state to check that the parsing and action handling systems
produce the correct result. Ref tests may be recorded by running
alacritty with `--ref-test` and closing the terminal by using the window
"X" button. At that point, the recording is fully written to disk, and a
serialization of important state is recorded. Those files should be
moved to an appropriate folder in the `tests/ref/` tree, and the
`ref_test!` macro invocation should be updated accordingly.

A couple of changes were necessary to make this work:

* Ref tests shouldn't create a pty; the pty was refactored out of the
  `Term` type.
* Repeatable lines/cols were needed; on startup, the terminal is resized
* by default to 80x24 though that may be changed by passing
  `--dimensions w h`.
* Calculating window size based on desired rows/columns and font metrics
  required making load_font callable multiple times.
* Refactor types into library crate so they may be imported in an
  integration test.
* A whole bunch of types needed symmetric serialization and
  deserialization. Mostly this was just adding derives, but the custom
  deserialization of Rgb had to change to a deserialize_with function.

This initially adds one ref test as a sanity check, and more will be
added in subsequent commits. This initial ref tests just starts the
terminal and runs `ll`.
2016-11-19 21:34:11 -08:00
Joe Wilm d97996e19d Make bindings configurable from alacritty.yml
Bindings were previously hardcoded within input.rs; adding, removing, or
changing a binding required a recompile! Now, bindings may be declared
in alacritty.yml. Even better, bindings are live-reloaded when
alacritty.yml is changed!

One unexpected benefit of this change was that all of the special casing
in input.rs has disappeared.

Conversely, config.rs has gained complexity for all of the
deserialization logic.

Resolves #3.
2016-11-17 17:17:54 -08:00
Joe Wilm 8360ab44ec Fallback to received chars when no bindings
Committed this on a plane with no internet; need to get a real glutin
ref pushed somewhere and update this commit before merging into master.
2016-11-17 17:15:56 -08:00
Joe Wilm 6925daa823 Fix/add some keybindings
Adds support for pageup, pagedown, home, and end. Fixes delete inserting
spaces.

Resolves #15.
2016-11-11 18:46:42 -08:00
Joe Wilm ea07f03ac9 Add test exhibiting SIGBUS on my machine 2016-10-16 11:16:29 -07:00
Joe Wilm 71de5501c4 Rustup and update dependencies
Now uses serde_dervive \o/
2016-10-14 16:38:15 -07:00
Joe Wilm 9d491f9f67 Start implementing copypasta, a clipboard library
Currently it only supports x11 via the xclip program, and that only
supports reading the clipboard contents.
2016-10-08 18:42:33 -07:00
Joe Wilm 7e69a070aa Don't write v when pasting on macOS
This is a bit of an experiment to see if simply handling 'v' in the
bindings will work or has any bugs not going through ReceivedCharacter.
The change is necessary though to prevent 'v' from being written in
front of every clipboard paste.
2016-09-27 08:27:39 -07:00
Joe Wilm 077a058cc4 wip
doesn't work on ubuntu 16.04 for some reason
2016-09-26 22:22:28 -07:00
Joe Wilm 3f6deb8e2f Refactor EventLoop into event_loop module
This type and its implementations were seriously cluttering main.rs.
2016-09-25 19:49:44 -07:00
Joe Wilm 6a5ac20def Resolve compiler warnings 2016-09-25 19:33:51 -07:00
Joe Wilm f1499d1d45 Use evented I/O for the pty
This was largely an experiment to see whether writing and reading from a
separate thread was causing terminal state corruption as described in
https://github.com/jwilm/alacritty/issues/9. Although this doesn't seem
to fix that particular issue.

Keeping this because it generally seems more correct than
reading/writing from separate locations.
2016-09-24 17:03:07 -07:00
Joe Wilm e3c68fed87 Fix tests
Errors/warnings fixed.
2016-08-14 20:25:15 -07:00
Joe Wilm 66e7228f41 Input expects modifier keys from Glutin
This is experimental on a separate branch of Glutin. It's intended to
fix the problem of certain key events not being delivered on alt-tab and
breaking the modifier state tracking.
2016-07-30 12:52:53 -07:00
Joe Wilm 6d4e10e2b9 Add test for input
Added a test while debugging arrow keys, no reason to delete it.
2016-07-29 18:27:45 -07:00
Joe Wilm 90e343b36d Early return in input handling
Don't need to handle modifier keys beyond updating state
2016-07-29 18:27:26 -07:00
Joe Wilm 90d66e63fc Switch to write_all in input handler
Make sure all input bytes get flushed
2016-07-29 18:26:51 -07:00
Joe Wilm 4bc4119987 Fix Control-H bug
Glutin sends both a received character and the key pressed event when a
key is pressed.  Because delete and backspace are mapped in reverse by
terminal standards, we ignore the received character 0x07 and 0x7f
values. However, this breaks Control-H since this normally sends 0x07 as
well. The fix here adds handling for Control-H through the input
tracking system.
2016-07-16 12:25:57 -07:00
Joe Wilm 6be23659ef Correctly handle Backspace and Delete
The default characters sent for this were incorrect. Delete now sends
xterm-compatible escapes (dch1, kdch1), and Backspace sends the delete
code 0x7f.
2016-07-04 09:26:50 -07:00
Joe Wilm bc2793a762 Move WriteNotifier type into input module
It's a generic impl of `input::Notify` for `Write` types; as such, it
seems completely reasonable to include in the input module. Moving it
also serves to declutter main.
2016-07-02 08:32:28 -07:00
Joe Wilm c8fd2c090c Add license headers to source files 2016-06-29 20:59:14 -07:00
Joe Wilm 078dd41e37 Function keys send escape sequences
This doesn't currently handle any of the modifiers, but it does mean
applications like `htop` can be used.
2016-06-23 21:24:35 -07:00
Joe Wilm 00223b32c9 Implement special input handling
There's a number of keys/combinations that should emit escape sequences
to the PTY when triggered. This commit adds a framework to support that.
The input::Processor is a type which tracks state of modifier keys. When
special keys (like arrow, function) are detected, the processor pulls up
a list of candidate escapes to send, and picks the first one based on
terminal mode and active modifier keys. The input::Processor is generic
over the thing receiving the escape sequences, the input::Notify type.
Included is a wrapper for `&mut io::Write` which implements
input::Notify and is currently used to connect the processor to the PTY
stream.

This added handling of the APP_CURSOR mode which changes affects input
processing.
2016-06-23 09:48:31 -07:00