Commit Graph

21 Commits

Author SHA1 Message Date
Joe Wilm 119c7d2856 Add support for wide characters 2017-03-02 09:19:01 -08:00
Joe Wilm 08f348ecea Optimize glyph cache access
Loading a glyph from the cache is a very hot operation in the renderer.
The original implementation would first check if a glyph was loaded and
then call `get()` which would have to search a second time. This showed
up as a very slow point in profiles.

This patch addresses glyph cache access in two ways: by using a faster
hasher optimized for small keys (fnv), and by using the entry API for
fetching a cached glyph. The `fnv` hasher is faster than the default and
is very efficient for small keys. Using the entry API on the HashMap
means only 1 lookup instead of two. The entry API has a downside where
the key needs to get cloned on fetches.

Reducing the GlyphKey width to 64-bits helps in both areas. Copying an
8-byte wide type is very cheap and thus limits downside of the entry
API. The small width also helps with the hasher performance.

Over all, this patch reduced typical render times by several hundred
microseconds on a 2013 MacBook Pro with a full screen terminal full of
text.
2017-01-26 08:43:53 -08:00
Kurnevsky Evgeny 1dca5617e2 Use clap as cli parser. 2017-01-24 08:38:38 -08:00
Lukas Lueg 64b42cd2f3 Use the log-crate instead of printing to stdout 2017-01-23 09:14:01 -08:00
Steven Fackler 41f99dc4c0 Dynamically generate test harness
This uses the rustc-test crate, a copy of the standard test crate, to
dynamically create tests for each reference test. No need to remember to
update the macro, just add the directory to ref!
2017-01-23 08:59:54 -08:00
Oula Kuuva 77f95f1477 Remove unnecessary feature
Proc_macro has been stable since 1.15.0, attribute no longer needed.
2017-01-18 22:28:46 -08:00
Manish Goregaokar 49187d53f2 Add `nightly` feature, use for `unlikely` intrinsic 2017-01-06 20:28:17 -08:00
Manish Goregaokar fbeded8ac5 Remove need for inclusive ranges 2017-01-06 20:28:17 -08:00
Manish Goregaokar c579d07993 Remove need for range_contains feature 2017-01-06 20:17:10 -08:00
Manish Goregaokar ee5a9f1338 Replace need for drop_types_in_const with lazy_static 2017-01-06 20:17:10 -08:00
Manish Goregaokar 800b65622c Remove need for step_by feature 2017-01-06 20:17:10 -08:00
Manish Goregaokar 085800c330 Make plugin feature optional 2017-01-06 15:14:32 -08:00
Joe Wilm a105be82cf Real support for placing config in XDG_CONFIG_HOME
Resolves #35.
2017-01-02 20:05:31 -08:00
Joe Wilm 6e708d2119 Implement visual component of mouse selections
This adds the ability to click and drag with the mouse and have the
effect of visually selecting text. The ability to copy the selection
into a clipboard buffer is not yet implemented.
2016-12-22 13:44:13 -05:00
Joe Wilm f32199ae69 Remove dead code 2016-12-16 22:52:38 -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 30bee80a69 Refactor cell selection out of renderer
The terminal now has a `renderable_cells()` function that returns a
`RenderableCellIter` iterator. This allows reuse of the cell selection
code by multiple renderers, makes it testable, and makes it
independently optimizable.

The render API now takes an `Iterator<Item=IndexedCell>` to support both
the new renderable cells iterator and the `render_string()` method which
generates its own iterator.

The `vim_large_window_scoll` ref test was added here because it provides
a nice large and busy grid to benchmark the cell selection with.
2016-12-11 20:23:41 -08:00
Joe Wilm 941818d88e Refactor limit function
Was reading through the code and realized this function could be cleaned
up significantly.
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