aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/grid
Commit message (Collapse)AuthorAge
* 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.
* 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.
* 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.
* 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.
* Fix crash on cursor resizeChristian Duerr2020-07-14
| | | Fixes #3960.
* 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.
* 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.
* 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.
* Clear selection on clear line/screen escapesKirill Chibisov2020-06-26
| | | | | Selection is now cleared if clear line or clear screen escape sequences are clearing content behind it.
* Fix scroll down escape pulling lines from historyChristian Duerr2020-06-25
| | | | | | | | | | | | | | | | | This works around a bug where the optimized version of the `Grid::scroll_down` function would just rotate the entire grid down if the scrolling region starts at the top of the screen, even if there is history available. Since rotations of scrolling regions should not affect the scrollback history, this optimized version is now only called when the max scrollback size is 0, making it impossible for the grid to have any history while it is used. Since the main usecase of this is the alternate screen buffer, which never has any history, the performance should not be affected negatively by this change. Fixes #3582.
* Add automatic scrolling during selectionChristian Duerr2020-06-18
| | | | | | | | | | | | | This adds a new `Scheduler` which allows for staging events to be processed at a later time. If there is a selection active and the mouse is above or below the window, the viewport will now scroll torwards the direction of the mouse. The amount of lines scrolled depends on the distance of the mouse to the boundaries used for selection scrolling. To make it possible to scroll while in fullscreen, the selection scrolling area includes the padding of the window and is at least 5 pixels high in case there is not enough padding present.
* Remove copyright notice from filesChristian Duerr2020-06-06
| | | | | | | | | | | | | | Keeping the license as part of every file bloats up the files unnecessarily and introduces an additional overhead to the creation of new modules. Since cargo already provides excellent dependency management, most of the code-reuse of Alacritty should occur through Rust's dependency management instead of copying it source. If code is copied partially, copying the license from the main license file should be just as easy as copying from the top of the file and making some adjustments based on where it is used is likely necessary anyways.
* Refactor Term/Grid separationChristian Duerr2020-05-30
| | | | | | | | | | | This commit aims to clear up the separation between Term and Grid to make way for implementing search. The `cursor` and `cursor_save` have been moved to the grid, since they're always bound to their specific grid and this makes updating easier. Since the selection is independent of the active grid, it has been moved to the `Term`.
* Extend style guideline documentationChristian Duerr2020-05-05
|
* Fix cursor position after alt screen resizeChristian Duerr2020-03-24
| | | | | | | | | | | | | | | | | This fixes a regression introduced in 4cc6421, which ignored the main grid's cursor when increasing the number of lines available, causing incorrect cursor position after restoring to the primary screen. Additionally another similar bug has been fixed where the grid was not scrolled correctly when shrinking while in the alternate screen. When the grid is resized multiple lines at once, there was also an issue with Alacritty either pulling all lines from history or none at all, instead of mixing both approaches and pulling just what is required. This lead to incorrect cursor positions when the resize could partially make use of history. Fixes #3499.
* Fix invisible selectionChristian Duerr2020-03-21
| | | | This resolves a bug where the very first/last cell would still be selected when both the start and the end were below/above the viewport.
* Add modal keyboard motion modeChristian Duerr2020-03-18
| | | | | | | | | | | | | | | | | | | This implements a basic mode for navigating inside of Alacritty's history with keyboard bindings. They're bound by default to vi's motion shortcuts but are fully customizable. Since this relies on key bindings only single key bindings are currently supported (so no `ge`, or repetition). Other than navigating the history and moving the viewport, this mode should enable making use of all available selection modes to copy content to the clipboard and launch URLs below the cursor. This also changes the rendering of the block cursor at the side of selections, since previously it could be inverted to be completely invisible. Since that would have caused some troubles with this keyboard selection mode, the block cursor now is no longer inverted when it is at the edges of a selection. Fixes #262.
* Fix selection with invisible start and endChristian Duerr2020-03-07
| | | | | This resolves an issue with the selection clamping, where no selection would be rendered at all when the start was above the viewport while the end was below it.
* Fix incorrect display offset after rotationKirill Chibisov2020-02-12
| | | | Regression was introduced in 4cc6421daa4ff5976ab43c67110a7a80a36541e5, however it was working before only due to grid.len() bug.
* Fix inconsistent test module namingChristian Duerr2020-01-28
|
* Fix incorrect grid.len() and grid.history_size()Kirill Chibisov2020-01-26
|
* Fix selection rotating outside of scrolling regionChristian Duerr2020-01-24
| | | | Fixes #2983.
* Fix first cell when selection is off screenChristian Duerr2020-01-21
| | | | | | | | | | | Since the expansion of the selection was done after clamping it to the grid, the selection would incorrectly move the clamped start over by one cell when the start was to the right of the original column. By resetting the side of the start point to `Left` before expanding, this can be circumvented. This also resolves a regression which broke backwards bracket selection. Fixes #3223.
* Fix cut off full width glyphs in last columnChristian Duerr2020-01-09
| | | | | | | | | | | | This resolves the issue with full width glyphs getting rendered in the last column. Since they need at least two glyphs, it is not possible to properly render them in the last column. Instead of rendering half of the glyph in the last column, with the other half cut off, an additional spacer is now inserted before the wide glyph. This means that the specific glyph in question is then three cells wide. Fixes #2385.
* Update outdated reftestsKirill Chibisov2020-01-04
|
* Fix crash on clear when scrolled up in historyKirill Chibisov2019-12-22
| | | Fixes #3112.
* Fix storage rotation errorChristian Duerr2019-12-13
| | | | | | | This fixes a regression introduced in e99057b179cbdc0851c36575dd043fcdaa45437a, which used `self.len` to calculate the remainder of `self.zero` during rotation instead of `self.inner.len()`, leading to a broken `self.zero` offset and incorrect rotation.
* Fix crash when resizing AlacrittyChristian Duerr2019-12-12
| | | Fixes #3088.
* Fix colored row reset performanceChristian Duerr2019-12-10
| | | | | | | | | | | | | | This fixes a bug where a row would always get reset completely if its background does not equal the default terminal background. This leads to big performance bottlenecks when running commands like `echo "\e[41m" && yes`. Instead of resetting the entire row whenever the template cell is not empty, the template cell is now compared to the last cell in the row. The last cell will always be equal to the previous template cell when `row.occ < row.inner.len()` and if `occ` is equal to the row's length, the entire row is always reset anyways. Fixes #2989.
* Remove tests failing in release modeChristian Duerr2019-11-19
|
* Fix deletion of lines when clearing the screenNathan Lilienthal2019-11-18
| | | | | | | | | | Previously Alacritty would delete lines when clearing the screen, leading to a loss of data in the scrollback buffer. Instead of deleting these lines, they are now rotated outside of the visible region. This also fixes some issues with Alacritty only resetting lines partially when the background color of the template cell changed. Fixes #2199.
* Fix URL highlightingChristian Duerr2019-11-03
| | | | Fixes #2898. Fixes #2479.
* Fix clippy warningsChristian Duerr2019-11-02
|
* Update dependenciesKirill Chibisov2019-10-23
|
* Update to winit/glutin EventLoop 2.0Christian Duerr2019-10-05
| | | | | | | | | | | | | | | | | | | | | | | | | This takes the latest glutin master to port Alacritty to the EventLoop 2.0 rework. This changes a big part of the event loop handling by pushing the event loop in a separate thread from the renderer and running both in parallel. Fixes #2796. Fixes #2694. Fixes #2643. Fixes #2625. Fixes #2618. Fixes #2601. Fixes #2564. Fixes #2456. Fixes #2438. Fixes #2334. Fixes #2254. Fixes #2217. Fixes #1789. Fixes #1750. Fixes #1125.
* Fix url highlight not showing with required modifiersChristian Duerr2019-08-26
|
* Move modifier check before URL searchChristian Duerr2019-08-03
| | | | | This makes sure that the URL search is only initiated when all required modifiers are held down. This should improve performance with long URLs.
* Switch to rfind_url for URL detectionChristian Duerr2019-08-01
| | | | | | | | | | | | | | | This switches to rfind_url for detecting URLs inside the grid. Instead of expanding at the cursor position, the complete terminal is searched from the bottom until the visible region is left with no active URL. Instead of having the field `cur` publicly accessibly on the `DisplayIterator`, there are the two methods `DisplayIterator::point` and `DisplayIterator::cell` for accessing the current element of the iterator now. This allows accessing the current element right after creating the iterator. Fixes #2629. Fixes #2627.
* Fix row occ not set during new and resetChristian Duerr2019-07-10
| | | | | | | | | | Since ref tests were only stored whenever winit requested the window close, they would not get stored properly when the terminal was closed through Alacritty using `exit`, Ctrl+D or similar. This moves the ref test code to the and of the main entry point, which will always be executed regardless of how the terminal was shutdown. Fixes #2613.
* Fix rows only resetting partiallyChristian Duerr2019-06-28
| | | | | | | This resolves an issue with rows only resetting partially, based on their `occ` state. However this state is not always accurate, so more than just the occupied elements need to be cleared. Fixes #2340.
* Fix performance issues with text reflowChristian Duerr2019-06-23
| | | | | Fixes #2567. Fixes #2414.
* Fix spelling mistakesJDTX2019-04-28
|
* Split alacritty into a separate cratesTheodore Dubois2019-04-28
The crate containing the entry point is called alacritty, and the crate containing everything else is called alacritty_terminal.