summaryrefslogtreecommitdiffstats
path: root/src/renderer/mod.rs
AgeCommit message (Collapse)Author
2019-04-28Split alacritty into a separate cratesTheodore Dubois
The crate containing the entry point is called alacritty, and the crate containing everything else is called alacritty_terminal.
2019-04-25Fix cursor disappearingChristian Duerr
The cfc20d4f34dca535654cc32df18e785296af4cc5 commit introduced a regression which would cause the cursor to disappear after the glyph cache has been filled. Since the cursor was not cached on the glyph cache, the cursor would quickly fill up the OpenGL texture with lots of cursor textures and then things would break after the atlas was filled completely. This adds a separate cursor cache which is keyed by the cursor style that will persist the texture without flooding the atlas. This fixes #2355.
2019-04-19Fix cursor dimension style issuesChristian Duerr
2019-04-19Fix cursor dimensions with font offsetChristian Duerr
Previously cursor dimensions were not calculated correctly when a font offset was specified, since the font offset was completely ignored. This has been fixed by moving all the cursor logic from the font into the Alacritty crate, applying the config's offsets before rasterizing the cursors. This has also fixed an issue with some cursors not being rendered as double-width correctly when over double-width glyphs. This fixes #2209.
2019-04-14Fix duplicate resize eventsChristian Duerr
If a resize event is identical to the current size, it is no longer propagated but the resize is discarded immediately. To further prevent resizes when not necessary, the list of monitors is enumerated and the DPR of the first display is assumed to be the target DPR. This allows spawning a window with dimensions when the config has columns and lines specified and the window only needs to be resized if the estimated DPR is not correct. Fixes #1825. Fixes #204.
2019-03-30Add rustfmt style guidev0.3.0-rc1Christian Duerr
2019-03-17Remove InclusiveRange codeChristian Duerr
This removes all inclusive range code since it has been recently stabilized in the standard lib.
2019-02-07Dynamically resize terminal for errors/warningsChristian Duerr
The warning and error messages now don't overwrite other terminal content anymore but instead resize the terminal to make sure that text can always be read. Instead of just showing that there is a new error and pointing to the log, errors will now be displayed fully in multiple lines of text, assuming that there is enough space left in the terminal. Explicit mouse click handling has also been added to the message bar, which made it possible to add a simple `close` button in the form of `[X]`. Alacritty's log file location is now stored in the `$ALACRITTY_LOG` environment variable which the shell inherits automatically. Previously there were some issues with the log file only being deleted when certain methods for closing Alacritty were used (like typing `exit`). This has been reworked and now Ctrl+D, exit and signals should all work properly. Before the config is reloaded, all current messages are now dropped. This should help with multiple terminals all getting clogged up at the same time when the config is broken. When one message is removed, all other duplicate messages are automatically removed too.
2019-02-04Simplify text shaderM. Stoeckl
2019-02-03Remove unused coordinate from rect shaderM. Stoeckl
2019-01-17Make all configuration fields optionalChristian Duerr
All configuration fields now have fallback values which will be used if the field is not present. This includes mouse, key bindings and platform specific differences. The mouse and key bindings are now filled by default, if the user rebinds a default mapping, it will be overwritten. To unbind a default binding, it can be mapped to `chars: ""`. Since all platform differences can now be correctly handled by the `src/config/mod.rs` code, it's no longer necessary to maintain separate configuration files, so the `alacritty_macos.yml` and `alacritty_windows.yml` have been deleted. Fixes #40. Fixes #1923.
2019-01-07Normalize Log Message StringsNathan Lilienthal
The general style for errors, warnings and info messages is to start with a capitalized letter and end without a period. The main exception is when dealing with nouns that are clearer with special case handling, e.g. "macOS failed to work" or "ioctl is borked".
2018-12-22Add proper underline and strikeout supportChristian Duerr
This makes use of the new rectangle rendering methods used to display the colored visual bell to add proper underline and strikeout support to Alacritty.
2018-12-17Add color option to visual bellChristian Duerr
This adds the option to specify the color of the visual bell using the `visual_bell.color` configuration setting. This is done by rendering a big quad over the entire screen, which also opens up options to draw other arbitrary rectangles on the screen in the future.
2018-12-15Fixing tabs in copy-pasteSteve Blundy
This resolves issues with copy-pasting tabs by including them in the pasted string. Selection of tabs is still inconsistent with what might be expected based on other terminal emulators, however the behavior hasn't regressed. This fixes https://github.com/jwilm/alacritty/issues/219.
2018-12-10Upgrade to Rust 2018Joe Wilm
This resolves a lot of NLL issues, however full NLL will be necessary to handle a couple of remaining issues.
2018-12-09Fix rendering of zero-width charactersChristian Duerr
Instead of rendering zero-width characters as full characters, they are now properly rendered without advancing the cursor. Because of performance limitations, this implementation only supports up to 5 zero-width characters per cell. However, as a result of this limitation there should not be any performance impact. This fixes #1317, fixes #696 and closes #1318.
2018-11-17Display errors and warningsChristian Duerr
To make sure that all error and information reporting to the user is unified, all instances of `print!`, `eprint!`, `println!` and `eprintln!` have been removed and replaced by logging. When `RUST_LOG` is not specified, the default Alacritty logger now also prints to both the stderr and a log file. The log file is only created when a message is written to it and its name is printed to stdout the first time it is used. Whenever a warning or an error has been written to the log file/stderr, a message is now displayed in Alacritty which points to the log file where the full error is documented. The message is cleared whenever the screen is cleared using either the `clear` command or the `Ctrl+L` key binding. To make sure that log files created by root don't prevent normal users from interacting with them, the Alacritty log file is `/tmp/Alacritty-$PID.log`. Since it's still possible that the log file can't be created, the UI error/warning message now informs the user if the message was only written to stderr. The reason why it couldn't be created is then printed to stderr. To make sure the deletion of the log file at runtime doesn't create any issues, the file is re-created if a write is attempted without the file being present. To help with debugging Alacritty issues, a timestamp and the error level are printed in all log messages. All log messages now follow this format: [YYYY-MM-DD HH:MM] [LEVEL] Message Since it's not unusual to spawn a lot of different terminal emulators without restarting, Alacritty can create a ton of different log files. To combat this problem, logfiles are removed by default after Alacritty has been closed. If the user wants to persist the log of a single session, the `--persistent_logging` option can be used. For persisting all log files, the `persistent_logging` option can be set in the configuration file
2018-11-12Fix incorrect padding calculationsChristian Duerr
The extra window padding was calculated in the renderer which lead to problems with the paddings calculated in the `src/display.rs` and `src/term/mod.rs`. As a solution, every instance of `config.padding().x/y` has been removed from the renderer (`src/renderer/mod.rs`), instead the padding is always passed through from the `src/display.rs`. The initial calculations during display creation and after resize then are scaled appropriately and then the extra padding is calculated. As a result every other location can just make use of the correctly calculated `size_info.padding_x` and `size_info.padding_y`. The documentation has been changed to clearly state that the padding is scaled by DPI now. This fixes #1773.
2018-11-11Center the grid inside the windowChristian Duerr
Currently alacritty always puts the grid at the top-left position of the window. The only distance to the top-left window border is set by the padding in the config. However the grid always has a fixed size, and if a cell doesn't completely fit the screen anymore, the padding at the bottom right window corner can be significantly bigger than the padding at the top left. To fix this whenever there is more space left and there would usually be a bigger padding at the bottom right, the space is now split up and added to the padding. This should always center the grid inside the window and make sure all borders have the same padding from the text area. This screenshot shows how it has been until now: ![Before](https://u.teknik.io/kRJwg.png) Here is how it looks now: ![After](https://u.teknik.io/m4puV.png) This fixes #1065.
2018-11-10Remove re-export of glutin size typesChristian Duerr
2018-11-10Upgrade Glutin to v0.19.0Matt Keeler
Some changes include: • Use the with_hardware_acceleration function on the ContextBuilder to not require the discrete GPU • Remove the LMenu and RMenu virtual key codes (winit 0.16.0 removed these because Windows now generates LAlt and RAlt instead • Replace set_cursor_state with hide_cursor (winit 0.16.0 removed the set_cursor_state function) • Replace GlWindow::hidpi_factor with GlWindow::get_hidpi_factor and change to expecting an f64 • Use the glutin/winit dpi size and position types where possible Glutin's dpi change event has been implemented. All size events now return logical sizes. As a result of that, the logical sizes are translated in the `display::handle_rezize` method so DPI scaling works correctly. When the DPI is changed, the glyph cache is updated to make use of the correct font size again. Moving a window to a different screen which is a different DPI caused a racing condition where the logical size of the event was sent to the `handle_resize` method in `src/display.rs`, however if there was a DPI change event before `handle_resize` is able to process this message, it would incorrectly use the new DPI to scale the resize event. To solve this issue instead of sending the logical size to the `handle_resize` method and then converting it to a physical size in there, the `LogicalSize` of the resize event is transformed into a `PhysicalSize` as soon as it's received. This fixes potential racing conditions since all events are processed in order. The padding has been changed so it's also scaled by DPR. The `scale_with_dpi` config option has been removed. If it's not present a warning will be emitted. The `winit` dependency on Windows has been removed. All interactions with winit in Alacritty are handled through glutin.
2018-10-16Add support for Windows (#1374)Zac Pullar-Strecker
Initial support for Windows is implemented using the winpty translation layer. Clipboard support for Windows is provided through the `clipboard` crate, and font rasterization is provided by RustType. The tty.rs file has been split into OS-specific files to separate standard pty handling from the winpty implementation. Several binary components are fetched via build script on windows including libclang and winpty. These could be integrated more directly in the future either by building those dependencies as part of the Alacritty build process or by leveraging git lfs to store the artifacts. Fixes #28.
2018-09-30Drop terminal lock before renderingtrimental
The terminal lock is now dropped before rendering by storing all grid cells before clearing the screen. This frees the terminal to do other things since the lock is now free, which lead to a performance benefit with high throughput applications.
2018-09-19Add hidden escape sequenceChristian Duerr
This adds support for the `hidden` escape sequence `\e[8m`, which will render the text as invisible. This has also raised a few questions about the rendering of foreground and background colors and their interaction with the different escape sequences. Previously, Alacritty has oriented itself after URxvt, which has some strange and unexpected behavior. The new implementation of color inversion is modeled after XTerm, which has a consistent pattern of always inverting the foreground and background colors. This should hopefully lead to less confusion for the user and a more consistent behavior. A full matrix showcasing the new way Alacritty inverses text can be found here: https://i.imgur.com/d1XavG7.png This fixes #1454 and fixes #1455.
2018-09-17Bump version number to 0.2.0 (#1492)Christian Duerr
* Change deb installation from crates.io to git There have been a number of issues an PRs opened since the cargo-deb installation does not work with the latest version from crates.io. To help out users until the crates.io version is updated, the installation instructions have been temporarily changed to install `cargo-deb` through github. * Revert cargo-deb install back to use crates.io Since `cargo-deb` has been updated on crates.io it is now possible to just install it from crates.io and build Alacritty's deb without having to rely on github. * Update dependencies This fixes an `illegal hardware instruction (core dumped)` error when building in release mode. * Remove redundant copy when selecting font_key * Bump version number to 0.2.0 Since the Scrollback branch introduces some major changes, this bumps the version number from 0.1.0 to 0.2.0. The versions of Alacritty have not been updated regularly to this point, so the scrollback branch is a good point in time to start updating Alacritty's version on a regular basis. Further changes to the readme, like dropping the 'alpha' status and updating it to 'beta' could also be introduced with this branch. This way there will be a clean cut which updates everything as soon as scrollback is merged. Building versions is another thing which would be a good thing to start reasonably quickly. However starting this on the main branch after scrollback has been merged seems like a more reliable way to move forward. This fixes #1240. * Add a CHANGELOG file A CHANGELOG file has been added to offer a bit more transparency over which features have been changed, added and potentially removed in Alacritty. There are various formats available for the CHANGELOG file but the most common and sensible one seems to be the one defined by https://keepachangelog.com/en/1.0.0. Following the template proposed by this it should be possible to create a clear CHANGELOG which makes it simple for new contributors to figure out exactly which formatting should be used for it. Since there have been quite a few changes to Alacritty already, not all changes have been added to the changelog. However a few entries have been ported just to give a bit of an example what the format should look like. This also helps with the 0.2.0 version since it will not be completely empty in the changelog. This fixes #1534. * Update CHANGELOG This updates the CHANGELOG to include the changes introduced by 43882ade33d4c14ee7248e489a2d33395faaa0b1.
2018-07-21Scrollback cleanupChristian Duerr
There were some unneeded codeblocks and TODO/XXX comments in the code that have been removed. All issues marked with TODO/XXX have either been already resolved or tracking issues exist.
2018-06-02Cleanup styleJoe Wilm
2018-05-11Fix clippy lintsChristian Duerr
2018-03-12Prevent negative cell dimensions (#1181)Christian Duerr
Prevent the cell dimensions from going below 1, this bug resulted in allocation of large amounts of memory in the scrollback PR but is also present on master. Currently the approach is to just `panic!`, however an `eprintln!` and `exit` could be an alternative too. I don't think it's realistic to check this at startup and it should have no performance impact since the failing method is only called once at startup. To make it a bit more clear what kind of values are accepted, the datatypes of offsets and paddings have also been changed so that these don't accept floats anymore and padding can never be negative. This should allow us to be a bit more strict with the config to make sure that errors are printed when invalid values are specified (like negative padding). This fixes #1167.
2018-03-04Remove all instances of unwrap() from configChristian Duerr
Unwrapping inside the config file parsing can lead to some issues that prevent us from falling back to a default configuration file. One instance of that issue was mentioned in #1135. Now all instances of `unwrap()` have been removed and replaced with proper error handling. This will make the config more robust and prevents live reload from silently breaking while alacritty is running. This also fixes a few currently existing clippy issues. Clippy added an additonal lint which complains about `MyStruct { field: field }`. These issues have been fixed, except for some false-positives and issues in external macros which will probably be fixed with future updates (rust-lang-nursery/bitflags#149)
2018-01-26Update dependenciesgolem131
Updated the version of some dependencies. This also changes to a new clippy version so clippy can work with the latest nightly compiler again. Some issues created by new lints have been fixed.
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-05Prevent font_size_modifier from sinking too low (#994)Christian Duerr
This replaces the `font_size_modifier` stored on the `Term` struct with a `font_size` field. With this change it is not necessary anymore to calculate the new font size from a delta but the current font size is always stored directly on the `Term` struct. As a result of this it is now possible to increase the font size by more than 127 steps at runtime. It also limits the minimum font size to 1, so issues with the `font_size_modifier` dropping far below font size 1 are resolved with this change. This fixes #955.
2017-12-24Fix stack overflow with too large glyphsJoe Wilm
This resolves the remaining issue of #842.
2017-12-23Update bitflags to v1Chet Gurevitch
2017-12-22Share LoadGlyph implementationsJoe Wilm
Previously there were two separate but intended-to-be-identical implementations. Now the two implementations simply delegate to a single, shared method. This should help correctness issues in the future.
2017-12-22Change LoadGlyph in LoaderApi to match RenderApiChristian Duerr
2017-12-22Fix stack-overflow when creating a new atlasChristian Duerr
When an atlas is full and the `insert` call fails, a new atlas should be created. This is the current strategy, however the atlas is put at the end of the vector, but the `current_atlas` index is set to 0, instead of the last element. This leads to a recursion where it keeps trying to insert into the full atlas at position 0 instead of the new at `atlas.len() - 1`. With this simple fix a stack-overflow is prevented because the new atlas is inserted as the first element, which then will be used correctly for loading new glyphs. This fixes jwilm/alacritty/issues/842 and might also solve jwilm/alacritty/issues/914 (I wasn't able to reproduce this with the latest master).
2017-12-03clippy: do and don't pass some things by reference as suggested ↵Matthias Krüger
(needless_pass_by_value, needless_borrow).
2017-12-03clippy: fix if_not_else warning 'breaking' the build. Swap blocks and change ↵Matthias Krüger
to "==".
2017-10-26Fix stack overflowJoe Wilm
Resolves #872
2017-10-21Fix solid background color opacity (#847)Joe Wilm
Since landing the patch adding transparency support to Alacritty, there's been an issue where othewise solid background cells were also being rendered partially transparent. Now, all filled background cells are rendered fully opaque. Some logic was added to support discarding filled backgrounds which had the same color as the default background. This means that, if the default background is #000 and a cell has that background, it will never be rendered opaque. This may not be correct. Note that many truecolor vim color schemes print spaces for default colored background cells. Performance can be dramatically improved by using ctermbg=NONE guibg=NONE to skip rendering those cells.
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-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-05Comment about duration arg to file watcherJoe Wilm
2017-09-05Reduce file watcher debounce periodJoe Wilm
500ms introduced a visual lag between file save and display update.
2017-09-05Update notifyJonathan Schleußer
2017-08-20Add background_opacity option to set terminal transparency (#331)Gabriel Martinez
The option is an Alpha struct that ensures that the contained float is between 0.0 and 1.0. Background colors are multiplied by the opacity to properly alpha blend them.