This adds a trait OnResize and a separate method handle_resize to the
display. Instead of having a callback to receive resize events, a list
of &mut OnResize are passed to this new method. Doing this allowed the
only RefCell usage in the codebase to be removed :).
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.
* config::Monitor is more ergonomic and self-contained
* Fixed an issue with macOS resize. Previously, the terminal was marked
as dirty in the window resize handler, but the display can't do that.
Instead, the event processor returns a flag whether it was requested
to wakeup.
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.
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().
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`.
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.
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.
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.
Also enables debug symbols in release profile by default. Until
Alacritty ships, there's going to be lots of perf analysis which needs
debug symbols.
The PriorityMutex low priority method was never used. Now it's just a
fair mutex.
This is only like the third time I've made this change. The issue of
having a blank screen at startup is due to x11 event loop + glX
interactions. Not sure what the problem is specifically, but
glXMakecurrent was blocking until the x11 event loop advanced.
The input and rendering are able to live on the same thread while still
removing unnecessary renders due to the
glutin::WindowProxy::wakeup_event_loop() method. The PtyReader just
kicks the event loop when there's something to do; otherwise, the event
loop just waits for something to happen and _doesn't_ draw in free run
mode.