aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src
Commit message (Collapse)AuthorAge
* Draw cursor with rect rendererKirill Chibisov2020-12-28
| | | | | | | | This commit makes cursors being drawn via rects, thus it's always above underlines/strikeouts. Also, since the cursor isn't a glyph anymore, it can't be obscured due to atlas switching while glyphs are rendered. Fixes #4404. Fixes #3471.
* Remove terminfo dependencyCaden Haustein2020-12-22
| | | | | Fixes #4597. Co-authored-by: Christian Duerr <contact@christianduerr.com>
* Replace serde's derive with custom proc macroChristian Duerr2020-12-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the existing `Deserialize` derive from serde with a `ConfigDeserialize` derive. The goal of this new proc macro is to allow a more error-friendly deserialization for the Alacritty configuration file without having to manage a lot of boilerplate code inside the configuration modules. The first part of the derive macro is for struct deserialization. This takes structs which have `Default` implemented and will only replace fields which can be successfully deserialized. Otherwise the `log` crate is used for printing errors. Since this deserialization takes the default value from the struct instead of the value, it removes the necessity for creating new types just to implement `Default` on them for deserialization. Additionally, the struct deserialization also checks for `Option` values and makes sure that explicitly specifying `none` as text literal is allowed for all options. The other part of the derive macro is responsible for deserializing enums. While only enums with Unit variants are supported, it will automatically implement a deserializer for these enums which accepts any form of capitalization. Since this custom derive prevents us from using serde's attributes on fields, some of the attributes have been reimplemented for `ConfigDeserialize`. These include `#[config(flatten)]`, `#[config(skip)]` and `#[config(alias = "alias)]`. The flatten attribute is currently limited to at most one per struct. Additionally the `#[config(deprecated = "optional message")]` attribute allows easily defining uniform deprecation messages for fields on structs.
* Fix invalid ESC escape sequence parsingChristian Duerr2020-12-17
| | | | | | | | | This strictens the ESC escape sequence parser to prevent invalid intermediates from being ignored. Previously the parser would just look at the first intermediate without validating that the rest of them is empty. If an escape like `\e(#0` is used now, it will no longer be accepted as `\e(0` since the intermediate `#` is also present.
* Fix draining of PTY when holding on exitChristian Duerr2020-12-17
| | | Fixes #4189.
* Fix scrolling region performance with fixed linesChristian Duerr2020-12-10
| | | | | | | | | | | | | | | | | | | | This resolves an issue with Alacritty's scrolling region performance when there's a number of fixed lines at the top of the screen. This affects commonly used applications like tmux or vim. Instead of using separate logic for when the scrolling region starts at the top of the screen without any fixed lines, the code should now try to figure out the target position of these fixed lines ahead of time, swap them into place and still perform the optimized implementation to move the grid. This comes with the small trade-off that since lines are swapped before rotating the screen without clearing or removing any lines during the rotation process, that the places the fixed lines have been swapped with will appear out of order when using scrolling regions in the primary screen buffer. Since the use of scrolling regions primarily affects the alternate screen and most terminals don't keep any history at all, this should however not cause any problems.
* Fix dimming of indexed colorsChristian Duerr2020-12-05
| | | | | | | | | | It seems like the list of colors might have changed a bit, leading to indexed colors not being transformed into their dim colors correctly. To prevent this from happening in the future, the dimming for colors in the range '0..=7' is now performed by offsetting them from the 'NamedColor::DimBlack'. Since this is the first dimmed color, this should always work as long as all dimmed colors are added in the correct order.
* Draw selection below Vi cursor when it's hiddenKirill Chibisov2020-11-28
|
* Fix DoS caused by excessive CSI parameter valuesChristian Duerr2020-11-26
|
* Add blinking cursor supportDettorer2020-11-23
| | | | | | | | This adds support for blinking the terminal cursor. This can be controlled either using the configuration file, or using escape sequences. The supported control sequences for changing the blinking state are `CSI Ps SP q` and private mode 12.
* Fix vi mode terminal resetChristian Duerr2020-11-19
| | | | | | | Since the vi mode is unrelated to the terminal emulation itself, it should not be reset during a `reset` to prevent unnecessary confusion. This also prevents the search from switching from vi mode to vi-less search without any indication to the user.
* Fix wide characters being cut offKirill Chibisov2020-11-17
| | | Fixes #791.
* Fix zerowidth characters in the last columnKirill Chibisov2020-11-15
| | | | | | | | | This commit fixes the issue that when attempting to write zerowidth characters into the last column, it is written in the second to last column instead. Fixes #4227. Co-authored-by: Christian Duerr <contact@christianduerr.com>
* Add ability to select text during searchChristian Duerr2020-11-13
| | | | | | | | | | | | | This removes the restriction of not being able to select text while the search is active, making it a bit less jarring of a UX when the user tries to interact with the terminal during search. Since the selection was used during vi-less search to highlight the focused match, there is now an option for a focused match color, which uses the inverted normal match color by default. This focused match is used for both search modes. Other mouse interactions are now also possible during search, like opening URLs or clicking inside of mouse mode applications.
* Fix use after free when dropping zerowidth dataKirill Chibisov2020-11-13
| | | | | | | | | | | | Commit ec42b42ce601808070462111c0c28edb0e89babb added an optional pointer for each cell, thus some old code that was optimizing copying with 'ptr::copy' was duplicating "unique" pointers ('Box'), which was resulting in use after free, after attempting to free both of these pointers. By replacing these unsafe blocks with safe Rust, the issue itself is fixed and the potential for future memory problems is eliminated from this area of the code.
* Deprecate the WinPTY backendChristian Duerr2020-11-06
|
* Use dynamic storage for zerowidth charactersChristian Duerr2020-11-05
| | | | | | | | | | | | | | | | | | | The zerowidth characters were conventionally stored in a [char; 5]. This creates problems both by limiting the maximum number of zerowidth characters and by increasing the cell size beyond what is necessary even when no zerowidth characters are used. Instead of storing zerowidth characters as a slice, a new CellExtra struct is introduced which can store arbitrary optional cell data that is rarely required. Since this is stored behind an optional pointer (Option<Box<CellExtra>>), the initialization and dropping in the case of no extra data are extremely cheap and the size penalty to cells without this extra data is limited to 8 instead of 20 bytes. The most noticible difference with this PR should be a reduction in memory size of up to at least 30% (1.06G -> 733M, 100k scrollback, 72 lines, 280 columns). Since the zerowidth characters are now stored dynamically, the limit of 5 per cell is also no longer present.
* Error on warnings when running clippyKirill Chibisov2020-10-29
| | | | | It should simplify tracking of new warnings raised on CI builds and when cross checking. This commit also enables warnings for 'rust_2018_idioms' and 'future_incompatible'.
* Add support for urgency hints CSITaylor Blau2020-10-10
| | | | | | | | | | | | | | | | | | | | | | | Teach Alacritty to stop setting the window as urgent upon a bell by emulating xterm's 'bellIsUrgent' resource and relevant CSI. When this resource is enabled (with 'CSI ? 1042 h'), a bell event causes the window to be marked as urgent. When the resource is disabled (with 'CSI ? 1042 l'), the window is not marked urgent in the event of a bell. There are two wrinkles worth noting here: - The 'TermMode::URGENCY_HINTS' does _not_ affect the terminal's configured bell command, since we only want to control whether or not the window is marked as urgent, not anything else. - In xterm, the 'bellIsUrgent' resource is _disabled_ by default. Since bouncing the dock icon has been the default in Alacritty on macOS thus far, do not make an effort to change that in this patch. This allows users to emit "\e[?1042l" and disable bouncing the dock icon. Fixes #2950.
* Bump glutin to 0.25.0Kirill Chibisov2020-10-07
| | | | | | | | | | | | Fixes #4206. Fixes #4162. Fixes #4017. Fixes #3998. Fixes #3831. Fixes #3782. Fixes #3708. Fixes #2734. Fixes #2714. Fixes #1801.
* Add support for single line terminalsii412020-09-27
| | | | | | | | | | | | | | | | | This changes the minimum terminal dimensions from 2 lines and 2 columns, to 1 line and 2 columns. This also reworks the `SizeInfo` to store the number of columns and lines and consistently has only the terminal lines/columns stored, instead of including the message bar and search in some places of the Alacritty renderer/input. These new changes also make it easy to properly start the selection scrolling as soon as the mouse is over the message bar, instead of waiting until it is beyond it. Fixes #4207. Co-authored-by: Christian Duerr <contact@christianduerr.com>
* Fix selection incorrectly expanding when scrolled in historyKirill Chibisov2020-09-26
| | | | | | | | | When doing selection expansion we were checking for wide char flags on a cells from the bottom of the terminal instead of in a current viewport when scrolled up in history, which was leading to expanding more than needed if we had wide chars on the same viewport cell, but in the bottom of the terminal. Fixes #4257.
* Remove unused Linear newtype. (#4248)Nathan Lilienthal2020-09-24
|
* Pass existing CLI parameters to SpawnNewInstanceRohan Poojary2020-09-06
| | | Co-authored-by: Christian Duerr <contact@christianduerr.com>
* Disable WinPTY with windows-gnu toolchainMateusz MikuĊ‚a2020-08-31
| | | Co-authored-by: Christian Duerr <contact@christianduerr.com>
* Add escape to report text area sizeAyose Cazorla2020-08-28
| | | | This implements the escapes `CSI 14 t` and `CSI 18 t` which report the text area size in pixels and characters.
* Unify term dimension callsChristian Duerr2020-08-25
| | | | | | | Since the `Term` implements the `Dimensions` trait itself, we shouldn't call `term.grid()` to call methods from the `Dimensions` trait. This removes all instances of this that I could find in the code at the moment.
* Add configuration file importsChristian Duerr2020-08-21
| | | | | | | | | | | | | | | | | | | This adds the ability for users to have multiple configuration files which all inherit from each other. The order of imports is chronological, branching out to the deepest children first and overriding every field with that of the configuration files that are loaded at a later point in time. Live config reload watches the directories of all configuration files, allowing edits in any of them to update Alacritty immediately. While the imports are live reloaded, a new configuration file watcher will only be spawned once Alacritty is restarted. Since this might cause loops which would be very difficult to detect, a maximum depth is set to limit the recursion possible with nested configuration files. Fixes #779.
* Use yellow/red from the config for message bar colorsKirill Chibisov2020-08-13
| | | | | | | | | | | | This commit completes the effort to use config colors for message bar content by picking red/yellow from user's colors.normal.{red,yellow} for error/warning messages instead of fixed colors. It also removes alacritty_terminal::term::color::RED and alacritty_terminal::term::color::YELLOW from the alacritty_terminal API, bumping its version to 0.11.0-dev. Fixes #4116.
* Add support for double underlinesChristian Duerr2020-08-12
| | | | | | | | | | | | | This adds support for double underlines using the colon separated escape sequence `CSI 4 : 2 m`. Alacritty will now also always fallback to the normal underline in case any of the other underlines like the undercurl are specified. The escape sequence `CSI 4 : 0 m` can now be used to clear all underlines. Some terminals support `CSI 21 m` for double underline, but since Alacritty already uses that as cancel bold which is a little more consistent, that behavior has not changed. So the colon separated variant must be used.
* Fix handling of wrapline flag in last lineChristian Duerr2020-08-12
| | | | | | | | | | | | | | This resolves an issue where Alacritty would crash when a wrapline flag was present in the last column of the last line. While it should not be possible to achieve this with normal text flow, it is possible to rotate the content downwards using the `CSI Ps T` escape, causing this bug to occur. This also works around other issues like the vi cursor jumping to the top of the screen when trying to move beyond the last column using the `l` key. In debug mode this even lead to a crash due to the overflow. Fixes #4109.
* Add support for colon separated SGR parametersChristian Duerr2020-08-07
| | | | | This implements the colon separated form of SGR 38 and 48. Fixes #1485.
* Use `tcgetpgrp` to get PID for SpawnNewInstanceChristian Duerr2020-08-06
| | | Fixes #4082.
* Bump minimum supported Rust version to 1.43.0Kirill Chibisov2020-07-28
|
* Fix CellForeground and CellBackground cursor colorsKirill Chibisov2020-07-27
| | | | | This commit fixes regression introduced in bedf5f3004e8f33011925ca471be02ead96f4581, when setting certain CellForeground/CellBackground combinations stoppped working.
* Invert fixed color cursor if it's close to cell bgChristian Duerr2020-07-26
| | | | | | | | | | | | | This should reduce the number of times people with fixed cursor colors run into troubles when existing text is already colored. Using just the background color as a metric instead of both background and foreground color should ensure that the cursor still has a clear shape, since just changing the foreground color for a cursor might be difficult to see. Always inverting the entire cursor instead of keeping the fixed foreground color is important to make sure the contrast isn't messed up. Fixes #4016.
* Add secondary DA supportChristian Duerr2020-07-23
| | | | | | | | | | | This adds support for the secondary DA escape sequence response. Alacritty's version is formatted allowing for up to 99 minor and patch versions, which should be sufficient. The tertiary DA is intentionally not implemented and marked as rejected in the documentation, since a lot of terminals do not support it, or report useless data (XTerm/URxvt/Kitty). Fixes #3100.
* Add support for searching without vi modeChristian Duerr2020-07-15
| | | | | | | | This implements search without vi mode by using the selection to track the active search match and advancing it on user input. The keys to go to the next or previous match are not configurable and are bound to enter and shift enter based on Firefox's behavior. Fixes #3937.
* Fix cursor reflowChristian Duerr2020-07-15
| | | | | | | | | | | | | | | | | | | | | This resolves three different issues with cursor reflow. The first issue was that the cursor could reach the top of the screen during reflow, since content was pushed into history despite viewport space being available. Since the cursor cannot leave the viewport, this would insert new space between the cursor and content (see #3968). Another issue was that the wrapline flag was not set correctly with content being available behind the cursor. Since the cursor is not necessarily at the end of the line, it is possible that the cursor should reflow to the next line instead of staying on the current one and setting the wrapline flag. The last bug fixed in this is about reflow with content available behind the cursor. Since that might have en effect on new lines being inserted and deleted below the cursor, the cursor needs to be reflown based on it. Fixes #3968.
* Fallback to SHELL instead of passwd if presentMattbazooka2020-07-14
| | | | | | | | | | | | | Instead of just always falling back to the shell specified in the passwd file when no config or cli shell was specified, Alacritty will not first look at the `$SHELL` environment variable. If this is unset, it will still read the passwd file. Since macOS is a bit peculiar and does not set the `$SHELL` environment variable by default, it is set manually to the shell used by Alacritty while any existing `$SHELL` variables are ignored. This matches the behavior of iTerm and Terminal.app. Co-authored-by: Christian Duerr <contact@christianduerr.com>
* Fix crash on cursor resizeChristian Duerr2020-07-14
| | | Fixes #3960.
* Remove gui dependencies from alacritty_terminalKirill Chibisov2020-07-11
| | | | | | | | This commit removes font dependency from alacritty_terminal, so it'll simplify the usage of alacritty_terminal as a library, since you won't link to system's libraries anymore. It also moves many alacritty related config options from it. Fixes #3393.
* Add option to run command on bell Kirill Chibisov2020-07-10
| | | Fixes #1528.
* Add regex scrollback buffer searchChristian Duerr2020-07-09
| | | | | | | | | | This adds a new regex search which allows searching the entire scrollback and jumping between matches using the vi mode. All visible matches should be highlighted unless their lines are excessively long. This should help with performance since highlighting is done during render time. Fixes #1017.
* Fix cursor reflowChristian Duerr2020-07-09
| | | | | | | | | | | | | | | | | | | | | | To make sure that output is consistent even while resizing the window, the cursor will now reflow with the content whenever the window size is changed. Since the saved cursor is more likely to represent a position in the grid rather than a reference to the content below it and handling of resize before jumping back to it is more likely than with the primary cursor, no reflow is performed for the saved cursor The primary cursor is unfortunately always reflowed automatically by shells like zsh, which has always caused problems like duplicating parts of the prompt and stretching it out "infinitely". Since the cursor is now reflowed appropriately the duplication of the shell prompt should be reduced, however it is possible that the shell moves the cursor up one line after it has already been reflowed, which will cause a line of history to be deleted if there is no duplicated prompt line above the reflowed prompt. Since this behavior is identical in VTE and Kitty, no attempt is made to work around it in this patch. Fixes #3584.
* Fix saved cursor handlingChristian Duerr2020-07-06
| | | | | | | | | | | This resolves several problems with handling of the saved cursor when switching between primary and alternate screen. Additionally ref-tests are also added for all common interactions to make sure the behavior does not regress. The behavior is based on XTerm's behavior except for interaction with `reset`. XTerm does not reset the alternate screen's saved cursor on `reset`, but VTE does. Since a `reset` should reset as much as possible, Alacritty copies VTE here instead of XTerm.
* Preserve linewrap flag across alt screen switchesChristian Duerr2020-07-06
| | | | | | While neither VTE, URxvt nor Kitty handle this, preserving the linewrap flag across alternate screen switches seems like the correct thing to do. XTerm also does handle this correctly, which indicates that it is a bug and not a feature.
* Document supported escape sequencesChristian Duerr2020-07-03
| | | Fixes #3440.
* Fix reflow of empty wrapped cursor lineChristian Duerr2020-07-01
| | | | | | | | | | | This bug was caused by trying to grow the terminal while the cursor line was wrapped but entirely empty. Resizing the terminal now accounts for the position of the deleted line and moves the cursor up only when the line deleted was above it. The deletion of the line was caused by the shell redrawing itself whenever the cursor is moved. Fixes #3583.
* Fix foreground dimming with truecolor textCarlo Abelli2020-06-29
| | | Fixes #3766.