summaryrefslogtreecommitdiff
path: root/src/main.rs
AgeCommit message (Collapse)Author
2018-06-02Move selection into GridJoe Wilm
Supporting selections with scrollback has two major components: 1. Grid needs access to Selection so that it may update the scroll position as the terminal text changes. 2. Selection needs to be implemented in terms of buffer offsets -- NOT lines -- and be updated when Storage is rotated. This commit implements the first part.
2018-05-11Fix clippy lintsChristian Duerr
2018-01-07Revert #987 behavior on macos (#1007)Christian Duerr
2018-01-06Honour working dir on linux (#987)Christian Duerr
2018-01-06Add clippy check to travisChristian Duerr
This commit adds clippy as a required step of the build process. To make this possible, all existing clippy issues have been resolved.
2018-01-06Improve ability of alacritty to deal with broken configChristian Duerr
Until now alacritty completely refuses to start when the config is broken in any way. This behavior has been changed so the worst-case is always that alacritty launches with the default configuration. When part of the config is broken, alacritty shouldn't instantly try to recover to the default config, but instead try to use defaults only for the parts of the config which are broken. This has also been implemented for most of the fields in the configuration. So it should be possible that parts are broken, but the rest is still used for the configuration. This fixes #954.
2017-12-13Remove the launcher and set the locale/current directory in alacritty (#879)Theodore Dubois
2017-12-03clippy: do and don't pass some things by reference as suggested ↵Matthias Krüger
(needless_pass_by_value, needless_borrow).
2017-10-22Rewrite err_println to eprintln introduced in Rust 1.19 (#799)Roel
2017-10-14Drop nightly featureJoe Wilm
Forgot to remove after being done with valgrind
2017-10-14Fix memory leak from font resizingJoe Wilm
The source of the leak was loading up multiple copies of the FT_face even when not necessary. Fonts are now appropriately cached for FreeType when going through the `Rasterize::load_font` API. Additionally, textures in the glyph cache are now reused. The result of this is that resizing to already loaded fonts is free from a memory consumption perspective.
2017-10-14Implement user actions for font resize (#625)Dan Aloni
Adds support for font resizing at run-time. Three new actions are introduced: * IncreaseFontSize - Increases current font size by 1.0 * DecreaseFontSize - Decreases current font size by 1.0 * ResetFontSize - Resets font size to that specified in the configuration. The stock config files have example configuration for each which should match gnome-terminal. For convenience, the config entries are: - { key: Key0, mods: Control, action: ResetFontSize } - { key: Equals, mods: Control, action: IncreaseFontSize } - { key: Subtract, mods: Control, action: DecreaseFontSize }
2017-10-06Revert "Update glutin & fix a few wayland issues (#815)"Joe Wilm
This reverts commit e17d38167e174a2cf664e430fe968ec6492e1f08. Was breaking builds for mac users.
2017-10-06Update glutin & fix a few wayland issues (#815)Victor Berger
This PR fixes a few wayland issues of alacritty (and updates glutin on the process because it is needed). Mainly two changes are done: 1. Add a drawing_ready() method on Window: see https://docs.rs/winit/0.8.2/winit/os/unix/trait.WindowExt.html#tymethod.is_ready for explanations. Hopefully glutin will be able to handle it itself in the future, but it currently does not. 2. resize window and OpenGL contextes. The way wayland forces winit to draw its own decorations and how surface size is defined by its content means that in practice: - winit's window.set_inner_size() defines the dimensions of the borders - glutins gl_window.resize() defines the dimensions of the content (and is a noop in other platforms) It is for now glutin's user responsibility to keep them in sync otherwise borders are drawn stupidly. This PR changes the resize methods of alacritty::Window to always update both. This fixed the borders issues for me, tested on weston.
2017-09-27Use clippy = "*", update, and fix some warnings (#796)Aaron Hill
Because there are so many clippy warnings in the current codebase, this commit removes '#![cfg_attr(feature = "clippy", deny(clippy))]', to make it easier to fix warnings incrementally.
2017-09-11Log where config was loaded fromJoe Wilm
2017-08-29Implement options to not start the config_monitor thread (#689)Liu Wei
Provide a command line option as well as a configuration file option. The command line option takes precedence.
2017-07-24add support for X input method (#691)Ted Yin
2017-06-19Implement semantic and line selection draggingJoe Wilm
Unlike the regular selection that is by cell, these selection modes highlight either semantic groupings or entire lines while the mouse is dragged.
2017-05-28Add config file as cli option (#576)Niklas Claesson
* Parse cli arguments before configuration file Parsing the cli arguments before the configuration file allows `--help` and `--version` to be used even if the configuration file is broken. * Add configuration file to command line arguments This commit adds a new command line flag `--config-file` to override the default configuration file location. If the specified file is unavailable, Alacritty will quit instead of generating a fallback. If the specified file is invalid, i.e. /dev/null, the compiled in defaults will be loaded instead.
2017-05-27Find and set $WINDOWID to X11 window ID (#586)ns
2017-05-24Ensure that the event loop thread cleanly exits on shutdownAaron Hill
Background: If a shell process exits with children still alive (typically due to the `disown` shell builtin), POLLHUP will not be sent to the master PTY file descriptor. This is due to the fact that the disowned process still has the slave PTY open as its STDIN, STDOUT, and STDERR. If a disowned process never reads or writes from its file descriptors (which is often the case for graphical applications), the event loop will end up blocking on poll()/select() when not handling user input received over the mio channel. When Alacritty shuts down and joins on the event loop thread, there can never be any more input on the mio channel - the main thread is no longer handling user keystrokes from the window. Unless a disowned process happens to access its slave PTY file descriptors, the event loop will never get the chance to deetect that it should exit. This commit extends the `Msg` enum to include an explicit `Shutdown` message, which ensures a clean shutdown (e.g. closing the 'recording' file). This allows the select()/poll() call to remain blocking, instead of needing to periodically check the shutdown state in between timed-out calls. Fixes #339
2017-01-29support for inverting the cursor or using colorsDanny Dulai
2017-01-28Add support for -e argumentNiklas Claesson
2017-01-23Return an error from logging::initializeJoe Wilm
Logging initialization now shares the same error handling code as the rest of the `run` function.
2017-01-23Use the log-crate instead of printing to stdoutLukas Lueg
2017-01-08print glutin events if --print-events is passedTom Crayford
When debugging many issues, it's often very helpful to have the raw glutin events printed out to stderr as they come in. This does that. Note that since `glutin::Event` doesn't implement `Display`, we just use rust's debugging output for now via `{:?}`.
2017-01-07Merge pull request #138 from honza/masterJoe Wilm
Add "shell" option to config
2017-01-06Clippy fixes!Manish Goregaokar
2017-01-06Add "shell" option to configHonza Pokorny
This allows you to configure the shell to use when alacritty starts. cc: #122
2017-01-06Add default macOS configJoe Wilm
Should solve the `monospace` issue people are seeing for now.
2017-01-06Write default config when not foundquininer kel
2017-01-01Improve error handling for clipboard actionsJoe Wilm
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.
2016-12-31Print nice error messages for font loading errorsJoe Wilm
Resolves #22.
2016-12-29Fix pty read sometimes not triggering drawJoe Wilm
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.
2016-12-29Fix some bugs with selectionsJoe Wilm
Moving the window on macOS would cause a panic in certain circumstances.
2016-12-29Hopefully fix read not triggering drawJoe Wilm
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
2016-12-27Minor cleanup in main()Joe Wilm
2016-12-27Fix bug with config reloadingJoe Wilm
The reloaded config was not used immediately.
2016-12-26Major cleanup for event handlingJoe Wilm
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.
2016-12-22Implement visual component of mouse selectionsJoe Wilm
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-16Fix config reloadingJoe Wilm
The main refactor broke config reloading; specifically, colors were not updating for subsequent draws.
2016-12-16Rustup and clippyJoe Wilm
All of the changes in this commit are due to clippy lints.
2016-12-12Remove need for Rc<RefCell<_>> usageJoe Wilm
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 :).
2016-12-11Track terminal cells on mouse movementJoe Wilm
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.
2016-12-11Finish main.rs cleanupJoe Wilm
* 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.
2016-12-11Display manages window, renderer, rasterizerJoe Wilm
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-11Add run() function and document itJoe Wilm
The doc comment outlines my plan about cleaning up this function.
2016-12-11Cleaning up main; Added window moduleJoe Wilm
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-11Move config path into Config typeJoe Wilm
This cleans up the Config::load API significantly. Several miscellaneous comments were also added.