Commit Graph

9 Commits

Author SHA1 Message Date
Joe Wilm bde4dacc79 Misc formatting fixes 2016-12-16 22:48:04 -08:00
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 ed0b1cfff0 Display manages window, renderer, rasterizer
This is part of an ongoing decoupling effort across the codebase and
tidying effort in main.rs. Everything to do with showing the window with
a grid of characters is now managed by the `Display` type. It owns the
window, the font rasterizer, and the renderer. The only info needed from
it are dimensions of characters and the window itself for sizing the
terminal properly. Additionally, the I/O loop has access to wake it up
when new data arrives.
2016-12-11 20:23:41 -08:00
Joe Wilm 4ba2931437 Cleaning up main; Added window module
Adds a wrapper for the glutin::Window which provides strongly typed
APIs and more convenient interfaces. Moves some gl calls into the
opengl-based renderer.

The point of most of the changes here is to clean up main().
2016-12-11 20:23:41 -08:00
Joe Wilm ed48d08c03 Implement Handler::identify_terminal for Term
The identify_terminal function signature had to change to support
writing to the terminal before processing additional input.
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 e4260134aa Fix alacritty shutdown when shell exits on macOS
Readiness for the pty file descriptor will never be HUP or ERROR; the
out-of-band flag raised by sigchld is used instead.

Resolves #14.
2016-11-11 18:02:38 -08:00
Joe Wilm 89937e7bc5 Clean up event_loop module
The main loop body was originally all written inline. There's now
separate functions for each of the actions the loop handles including
channel events, pty reading, and pty writing. There's also helper
functions on State for managing the write list.

The `EventLoop` and its `State` are returned when joining with the
thread it spawns. This will potentially be helpful once config reloading
is introduced.
2016-09-26 08:28:38 -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