Commit Graph

1562 Commits

Author SHA1 Message Date
Joe Wilm e2e98ed6c2 Force drawing when config reloads 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 61c1e37c46 Add comments in main loop 2016-12-11 20:23:41 -08:00
Joe Wilm 43397cefec Borrow glutin::Window instead of using Arc
glutin::Window is not threadsafe; putting it into an Arc is
misleading (although the glutin::Window type claims to be Send + Sync).
The reference was just needed on the main thread anyway, so it's better
to just pass a ref around directly.
2016-12-11 20:23:41 -08:00
Joe Wilm ce32eee099 Refactor color list management
There's now a ColorList type that provides strongly typed indexing for
not only usize but NamedColor as well. Previously, the `NamedColor` was
casted to a `usize` when indexing the colors. Additionally, only one
copy of the ColorList needs to exist;it's borrowed from the `Config`
when rendering, and the renderer doesn't need a copy.
2016-12-11 20:23:41 -08:00
Joe Wilm 23e36f1925 Add support for indexed colors
ANSI escape sequences like `\x1b[48;5;10m` were not supported until now.
Specifically, the second attribute, 5, says that the following attribute
is a color index.

The ref tests were updated since `enum Color` variants changed.
2016-12-11 20:23:41 -08:00
Joe Wilm 3151ef8625 Rename RenderApi::render_grid() to render_cells()
This probably should have been renamed in the original refactor, but oh
well. `render_cells()` takes a generic parameter `I` which is any
`Iterator<Item=IndexedCell>` and is thus no longer coupled to the grid
type. Renaming it reflects that.
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 7bf3d059c3 Move term::cell module to its own file
The cell module was previously implemented within term.rs. Now each
module has its own file.
2016-12-11 20:23:41 -08:00
Joe Wilm 74dcba59d8 Document a couple of methods
Also fixes formatting on the Term::new method signature.
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 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 b6c372ab48 Use checked subtraction for backspace
Some shells will send a backspace at column 0, apparently.
2016-12-10 10:14:45 -08:00
Joe Wilm d19e6e38a4 Update to latest Rust 2016-11-23 17:23:14 -08:00
Joe Wilm 52a3b0aece Remove unnecessary slicing
json::from_str takes a &str which will auto deref from &String.
2016-11-20 07:45:18 -08:00
Joe Wilm d964de708d Add README.md
Currently just want to see travis status prominently on repo page.
2016-11-19 21:51:48 -08:00
Joe Wilm 88a92982b1 Fix mouse bindings
Config expected key and the default config file had the wrong section.
2016-11-19 21:49:23 -08:00
Joe Wilm 3db0bcb2a7 Fix glutin wayland 2016-11-19 21:34:22 -08:00
Joe Wilm 0dfba30181 Add a number of simple ref-tests
Also adds a feature `err-println` for enabling `err_println!` printing.
2016-11-19 21:34:22 -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 cb2bc4eadd Fix test for Cell layout
bytes 2 and 3 are not necessarily zeroed
2016-11-17 17:16:01 -08:00
Joe Wilm cbb9167d43 Redraw screen on focus
Fixes an issue where waking from sleep on macOS would continue showing
the lock screen if Alacritty was the active app.
2016-11-17 17:16:01 -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 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 8cbd768094 Fix resize on macOS leaving screen blank
This still has a problem where intermediate sizes are not drawn.
Apparently cocoa blocks the event loop during resize. This needs to be
fixed in Glutin.

Resolves #16.
2016-11-11 17:40:12 -08:00
Joe Wilm a652b4a65f Rustup 2016-11-11 16:55:58 -08:00
Joe Wilm 3e0b2b6c58 Fix config file reloading on macOS 2016-11-11 16:53:13 -08:00
Joe Wilm be036edbdd Workaround for cutoff glyphs
There's an issue where drawing the cell backgrounds will overwrite part
of a neighboring glyph. The real solution here is to figure out glyph
metrics properly, but simply limiting to 2 draw calls per frame (first
background, then all the glyphs) makes the problem "go away".
2016-11-11 16:51:01 -08:00
Joe Wilm 82c8804f44 Update default config
Contains comments about what requires a restart and also includes the
bold+bright flag.
2016-10-28 09:26:16 -07:00
Joe Wilm a81152cc43 Support drawing bold test with bright colors
This feature is on by default
2016-10-28 09:19:48 -07:00
Joe Wilm 7cd8a6ca12 Merge branch 'reload-colors' 2016-10-28 08:52:56 -07:00
Joe Wilm f8cb6d42cc Set colors on CPU
Indexing colors on the vertex shader added complexity and after
profiling suggests perf is basically the same. This commit will still be
here in case it makes sense to try this again at some point.
2016-10-28 08:36:26 -07:00
Joe Wilm cb2fa27f15 Dynamically update render_timer config
Everything else was already in place, just needed to set the flag.
2016-10-28 08:11:45 -07:00
Joe Wilm 06ea6c8e56 Move config reloading to separate thread
This feature was previously shoved into the renderer due to initial
proof of concept. Now, providing config updates to other systems is
possible. This will be especially important for key bindings!
2016-10-27 10:16:08 -07:00
Joe Wilm e503baf2e7 Live shader reloading is now a feature
Which means it can be disabled in release builds. No more working on a
renderer feature and actually breaking the Alacritty your editor is
running inside.
2016-10-27 08:43:23 -07:00
Joe Wilm 0958c0f0f2 Move color indexing to vertex shader
Move more work to GPU from CPU. Some very non-scientific profiling
suggests this is implementation is more performant, but more work should
be done there.
2016-10-24 11:01:43 -07:00
Joe Wilm e9304afd36 Expand cell::Color layout tests
The whole enumeration should be well defined for the renderer.
2016-10-24 08:44:07 -07:00
Joe Wilm 741a8b3f47 Fix some compiler warnings 2016-10-24 08:36:14 -07:00
Joe Wilm b29eed27cf Add discriminant_value test for cell::Color
The renderer should be able to use the discriminant_value to determine
vertex colors.
2016-10-24 08:24:33 -07:00
Joe Wilm 5876b4bf7a Proof of concept live reloading for colors
The architecture here is really poor. Need to move file watching into a
dedicated location and probably have an spmc broadcast queue. other
modules besides rendering will care about config reloading in the
future.
2016-10-23 15:37:06 -07:00
Joe Wilm ea07f03ac9 Add test exhibiting SIGBUS on my machine 2016-10-16 11:16:29 -07:00
Joe Wilm d4c1d51e36 Make colors configurable from file
Added solarized dark color scheme for testing purposes.

Resolves #1.
2016-10-15 15:56:27 -07:00
Joe Wilm 71de5501c4 Rustup and update dependencies
Now uses serde_dervive \o/
2016-10-14 16:38:15 -07:00
Joe Wilm 1d60fdd6e3 Fix X11 WaitEventsIterator Busy Loop
Resolves #10.
2016-10-14 12:19:18 -07:00
Joe Wilm f69ea009a3 Implement blank character insertion
This is used by things like Bash's reverse-i-search and things get
*very* messed up without it.
2016-10-10 08:29:51 -07:00
Joe Wilm b80abe9a54 Add script for creating flamegraph with perf
Resolves #8
2016-10-08 21:30:21 -07:00