aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
Commit message (Collapse)AuthorAge
...
* Merge pull request #138 from honza/masterJoe Wilm2017-01-07
|\ | | | | Add "shell" option to config
| * Add "shell" option to configHonza Pokorny2017-01-06
| | | | | | | | | | | | This allows you to configure the shell to use when alacritty starts. cc: #122
* | Clippy fixes!Manish Goregaokar2017-01-06
|/
* Add default macOS configJoe Wilm2017-01-06
| | | | Should solve the `monospace` issue people are seeing for now.
* Write default config when not foundquininer kel2017-01-06
|
* Improve error handling for clipboard actionsJoe Wilm2017-01-01
| | | | | | Previously, these could have crashed alacritty. Now, they simply print an error message in Red to stderr. The Red format wrapper was moved to a central location where both main.rs and the alacritty lib can access it.
* Print nice error messages for font loading errorsJoe Wilm2016-12-31
| | | | Resolves #22.
* Fix pty read sometimes not triggering drawJoe Wilm2016-12-29
| | | | | | | | | | | There was a lot of complexity around the threadsafe `Flag` type and waking up the event loop. The idea was to prevent unnecessary calls to the glutin window's wakeup_event_loop() method which can be expensive. This complexity made it difficult to get synchronization between the pty reader and the render thread correct. Now, the `dirty` flag on the terminal is also used to prevent spurious wakeups. It is only changed when the mutex is held, so race conditions associated with that flag shouldn't happen.
* Fix some bugs with selectionsJoe Wilm2016-12-29
| | | | Moving the window on macOS would cause a panic in certain circumstances.
* Hopefully fix read not triggering drawJoe Wilm2016-12-29
| | | | | | | | The terminal mutex is no longer released between event processing and doing a draw. This may fix the race condition with data arriving but not being displayed until a subsequent event. cc #29
* Minor cleanup in main()Joe Wilm2016-12-27
|
* Fix bug with config reloadingJoe Wilm2016-12-27
| | | | The reloaded config was not used immediately.
* Major cleanup for event handlingJoe Wilm2016-12-26
| | | | | | | | | | | | | | | | | | | | | | The event handling code grew organically over time, and with that came a number of warts. The primary issue was with passing some random selection of arguments to the input::Processor based on what the input was. There was the issue that if multiple events were drained from a single PollEventsIterator, the terminal mutex was potentially locked and unlocked many times. Finally, and perhaps most importantly, there was no good way to pass necessary state to the Action executor without going through several API layers. To fix all that, the input::ActionContext and input::Processor are now generated once per call to the event::Processor. The input::Processor holds onto the ActionContext so that it doesn't need to be passed through layers of function calls. When a binding is activated, the ActionContext is simply passed to the handler. This did have the effect of breaking the input::Processor tests (specifically, those relating to bindings). The issue was not addressed in this commit since a larger refactor of the bindings is planned which should also improve testability.
* Implement visual component of mouse selectionsJoe Wilm2016-12-22
| | | | | | 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.
* Fix config reloadingJoe Wilm2016-12-16
| | | | | The main refactor broke config reloading; specifically, colors were not updating for subsequent draws.
* Rustup and clippyJoe Wilm2016-12-16
| | | | All of the changes in this commit are due to clippy lints.
* Remove need for Rc<RefCell<_>> usageJoe Wilm2016-12-12
| | | | | | | 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 :).
* Track terminal cells on mouse movementJoe Wilm2016-12-11
| | | | | | | 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.
* Finish main.rs cleanupJoe Wilm2016-12-11
| | | | | | | | * 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.
* Display manages window, renderer, rasterizerJoe Wilm2016-12-11
| | | | | | | | | | 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.
* Add run() function and document itJoe Wilm2016-12-11
| | | | The doc comment outlines my plan about cleaning up this function.
* Cleaning up main; Added window moduleJoe Wilm2016-12-11
| | | | | | | | 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().
* Move config path into Config typeJoe Wilm2016-12-11
| | | | | This cleans up the Config::load API significantly. Several miscellaneous comments were also added.
* Cleanup cli option parsingJoe Wilm2016-12-11
| | | | | | This introduces the `cli` module and the `cli::Options` type. This type holds all the options passable on the command line in addition to providing arg parsing.
* Force drawing when config reloadsJoe Wilm2016-12-11
|
* Add comments in main loopJoe Wilm2016-12-11
|
* Borrow glutin::Window instead of using ArcJoe Wilm2016-12-11
| | | | | | | 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.
* Refactor color list managementJoe Wilm2016-12-11
| | | | | | | | 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.
* Add support for indexed colorsJoe Wilm2016-12-11
| | | | | | | | 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.
* Rename RenderApi::render_grid() to render_cells()Joe Wilm2016-12-11
| | | | | | | 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.
* Refactor cell selection out of rendererJoe Wilm2016-12-11
| | | | | | | | | | | | | | 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.
* Add support for recording/running ref testsJoe Wilm2016-11-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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`.
* Make bindings configurable from alacritty.ymlJoe Wilm2016-11-17
| | | | | | | | | | | | | | | 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.
* Fix resize on macOS leaving screen blankJoe Wilm2016-11-11
| | | | | | | | 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.
* Support drawing bold test with bright colorsJoe Wilm2016-10-28
| | | | This feature is on by default
* Dynamically update render_timer configJoe Wilm2016-10-28
| | | | Everything else was already in place, just needed to set the flag.
* Move config reloading to separate threadJoe Wilm2016-10-27
| | | | | | 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!
* Fix some compiler warningsJoe Wilm2016-10-24
|
* Proof of concept live reloading for colorsJoe Wilm2016-10-23
| | | | | | | 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.
* Make colors configurable from fileJoe Wilm2016-10-15
| | | | | | Added solarized dark color scheme for testing purposes. Resolves #1.
* Rustup and update dependenciesJoe Wilm2016-10-14
| | | | Now uses serde_dervive \o/
* Start implementing copypasta, a clipboard libraryJoe Wilm2016-10-08
| | | | | Currently it only supports x11 via the xclip program, and that only supports reading the clipboard contents.
* wipJoe Wilm2016-09-26
| | | | doesn't work on ubuntu 16.04 for some reason
* Clean up event_loop moduleJoe Wilm2016-09-26
| | | | | | | | | | | 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.
* Refactor EventLoop into event_loop moduleJoe Wilm2016-09-25
| | | | This type and its implementations were seriously cluttering main.rs.
* Resolve compiler warningsJoe Wilm2016-09-25
|
* Use evented I/O for the ptyJoe Wilm2016-09-24
| | | | | | | | | | 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.
* Fix some compiler warningsJoe Wilm2016-09-23
| | | | | | | | | 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.
* Fix refresh bugJoe Wilm2016-09-21
| | | | | | Terminal output wouldn't reliably refresh the screen. Fix is to only modify this flag when the terminal lock is held which suggests a larger refactoring should happen.
* Delete an extra spaceJoe Wilm2016-09-18
|