aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-06-02Improve storage comparison algorithmChristian Duerr
Instead of iterating over the raw storage vector because the offsets don't allow direct comparison, the comparison is now done in chunks. Based on benchmarking this is a lot more efficient than using split_off + append or iterating over the elements of the buffer. The `history_size` field has also been removed from the storage structure because it can be easily calculated by substracting the number of visible lines from the length of the raw storage vector.
2018-06-02Reset grid content when running `reset`Christian Duerr
In the current scrollback PR the `reset` command does not affect the scrollback history. To make sure the terminal is properly reset, it should clear the scrollback history. This commit fixes this by creating a new and empty grid whenever `reset` is executed. It takes the current dimensions and history size from the old grid. Right now there's an empty ref-test called `grid_reset` without any content, this should be implemented once #1244 is resolved. This fixes #1242.
2018-06-02Enable history comparison in ref-testsChristian Duerr
Previously ref-tests just ignored the scrollback history to keep the old tests working, this would lead to new tests which rely on scrollback history to succeeed even though they should not. This has been fixed and it is now possible to create ref-tests with and without scrollback history. When available the scrollback history is compared, but the old tests still work without having to adjust them. This fixes #1244.
2018-06-02Reset grid when running `reset`Christian Duerr
In the current scrollback PR the `reset` command does not affect the scrollback history. To make sure the terminal is properly reset, it should clear the scrollback history. To make resetting efficient, instead of resetting the history, the scrollback history is hidden by setting `grid.scroll_limit` to `0`. This will not clear the history but instead just make it inaccessible, which should have the same effect. The visible area is reset by the shell itself, so in combination this clears the complete terminal grid from a user perspective. This fixes #1242.
2018-06-02Fix bright characters in first columnChristian Duerr
This bug was introduced by the commit which fixed the invisible cursor in the first column (54b21b66ecc6f8f149d1425567e0e3d766a3ac54). To resolve this the alternative implementation by @jwilm has been applied which seems to work out. This fixes #1259.
2018-06-02Revert "Fix cursor not showing in first column"Christian Duerr
This reverts commit 54b21b66ecc6f8f149d1425567e0e3d766a3ac54.
2018-06-02Compile on stableJoe Wilm
2018-06-02Fix order of lines after resizeChristian Duerr
There was an issue where the lines would be messed up when the terminal was resized, this was because lines were just added/removed at the end of the buffer instead of the actual end of the terminal (since the end of the terminal might be in the middle of the buffer). This has been fixed by relying on `self.zero` to determine the position of the start of the terminal and then calculating where lines have to be inserted/removed. Some tests have also been added with documentation that should make it a little easier to understand how the process works and how the raw buffer is layed out. This should all work no matter how big the scrollback history and even when the currenty viewport is not at the bottom of the terminal output.
2018-06-02Fix scrollback history size 0 bugChristian Duerr
There was an issue where alacritty would panic whenever the scrollback history size is set to 0, this fixes that issue. The panic was caused by a substraction with unsigned integers which was underflowing, this has been fixed to use `saturating_sub`. After that was fixed there was still a bug where scrollback would not behave correctly because the number of lines in the grid was decided at startup. This has been adapted so whenever the size of the terminal changes, the scrollback history and grid adapts to make sure the number of lines in the terminal is always the number of visible lines plus the amount of scrollback lines configured in the config file. This fixes #1150.
2018-06-02Add documentation to explain the processChristian Duerr
2018-06-02Fix cursor not showing in first columnChristian Duerr
There was a bug in the display iterator where the first column was never reached after the top line because it was instantly incremented to 1 after it was reset when iterator column reached the end of the terminal width. This has been fixed by making sure that the column is never incremented when the column is reset due to a change in terminal line. This fixes #1198.
2018-06-02Fix BCE ref testsJoe Wilm
BCE was broken in attempt to optimize row clearing. The fix is to revert to passing in the current cursor state when clearing.
2018-06-02Fix selection testsChristian Duerr
The latest selection changes broke a few tests, these have been corrected. Two of these tests were broken because they assumed different span types, the test have been changed here because the result was correct. One test did actually catch a bug where selection of two cells from right to left would incorrectly mark the cells as selected even though they should not have been, this has been fixed in the `simple_span` method.
2018-06-02Fix grid scroll testsJoe Wilm
2018-06-02Make tests compile againJoe Wilm
Some tests are still not passing, though. A migration script was added to migrate serialized grids from pre-scrollback to the current format. The script is included with this commit for completeness, posterity, and as an example to be used in the future. A few tests in grid/tests.rs were removed due to becoming irrelevant.
2018-06-02Rework auto-scrolling optionsChristian Duerr
This changes two things, the first thing it does is that now whenever a keybinding sends an escape sequence, the viewport is automatically scrolled to the bottom. This is enabled by default and fixes #1187. The second thing is automatic scrolling when a command writes to the terminal. So when running a command like `sleep 3; ls -lah`, alacritty will scroll to the bottom once the output is sent, even if the viewport is currently not at the bottom of the scrollback. Because this can have an impact on performance, and is not enabled by default in terminals like iTerm or Termite (VTE), it is an opt-in setting in the config.
2018-06-02Fix regression with scrolling regionsJoe Wilm
Resolves #1154
2018-06-02Refactor `span_simple` selectionChristian Duerr
The current `span_simple` selection is everything but simple. This version should have the same functionality as the current `span_simple` with the difference that a lot of complexity has been removed. Not only is this code shorter, it should also be significantly easier to understand with no "magic" to it. This will hopefully prevent us from having an unmaintainable blob of off-by-one guessing in the repo. Also removed the `out` file which I used in the original PR because scrollback is not implemented yet. :)
2018-06-02Replace scrolling methods with enumChristian Duerr
The different scrolling methods added a bunch of boilerplate where the call was just forwarded to the next struct, this has been removed by making the scroll amount into a struct. Now everything is called through one method and the parameter decides how far the viewport should be scrolled.
2018-06-02Add scrollback hotkeysChristian Duerr
This offers a few additional hotkeys that can be used in combination with scrollback. None of these are used by default yet. This implements the following bindings: - ScrollPageUp: Scroll exactly one screen height up - ScrollPageDown: Scroll exactly one screen height down - ScrollToTop: Scroll as far up as possible - ScrollToBottom: Scroll as far down as possible This fixes #1151.
2018-06-02Fix selection starting in first cellChristian Duerr
When selecting to the top and starting in the first cell, alacritty would crash. These cases have been fixed and now selection should be completely working.
2018-06-02Fix buggy selection when scrolling downChristian Duerr
When scrolling down with a selection on screen the first line was not properly selected. This has been fixed by making sure the selection always starts in the first cell when it is only partially visible.
2018-06-02Fix multi-line selection with single cell endChristian Duerr
When the user selected multiple lines, dragging the selection downwards, and then leaves the cursor to the left side of the first cell, the first cell was still incorrectly selected. This has been fixed. The selection also did not update if the mouse was outside of the window, now all movement events are accpeted even when the mouse is outside of the window. This allows updating the selection when the user is dragging the cursor too far. Mouse movement and click events outside of the window are not propagated, these are only used for updating the selection.
2018-06-02Fix selection in scrollbackChristian Duerr
There were a few issues with selection in scrollback that were mainly off-by-one errors. This aims at fixing these issues. This also fixes a bug that currently exists in master where the last cell is not selected when the mouse leaves the window to the right.
2018-06-02Fix linux config default valueChristian Duerr
2018-06-02Merge branch #1095Christian Duerr
Because there was some overlap with branch #1095, these two PRs have been added together and the config has been restructured to make use of a `scrolling` section. The default faux scrolling amount has also been changed to `3` because this simplifies the code and falls in line with what most other terminal emulators do. There should be no additional test failures due to this.
2018-06-02Make normal scrolling line amount configurableChristian Duerr
It is now possible to configure the amount of lines the viewport should scroll when using the normal scrolling mode. This fixes #1160.
2018-06-02Fix crash when selection leaves viewportChristian Duerr
There was an issue where alacritty tries to convert the lines in a selection to the on-screen lines even when the selection is not on the screen. This results in a crash. To prevent this from happening the selection now is not shown if it is off the screen. There currently still is a bug that when the selection is at the top of the screen but still half visible, it will not show the top line as selected but start in the second line. This bug should be resolved with https://github.com/jwilm/alacritty/pull/1171. This fixes #1148.
2018-06-02Disable faux scrolling when shift is pressedChristian Duerr
To make it possible to access the native scrollback buffer in the alternate screen without having to disable faux scrolling, faux scrolling is now disabled when the `shift` key is held down. This should allow alacritty to have the best of both worlds, a native scrollback buffer in the alternate screen buffer and faux scrolling.
2018-06-02Add faux_scrolling back to scrollbackChristian Duerr
2018-06-02Provide correct default for scroll_historyChristian Duerr
When implementing fallback to the default value with an u32 you will get 0 as the default value. However the default scrollback value is 10_000. A custom deserializer has been implemented which automatically falls back to the correct default value.
2018-06-02Add `failure_default` deserializer to `scroll_history`Christian Duerr
2018-06-02Fix 4+ line copyingJoe Wilm
2018-06-02Add SCROLL_MULTIPLIERJoe Wilm
Scroll wheel needs some scaling so it feels like urxvt and friends.
2018-06-02Support selections with scrolling bufferJoe Wilm
Selections now *mostly* work. They move as the buffer scrolls, copying works as it should, and it looks like the different selection modes behave properly as well. The new Selection implementation uses buffer coordinates instead of screen coordinates. This leads to doing a transform from mouse input to update the selection, and back to screen coordinates when displaying the selection. Scrolling the selection is fast because the grid is already operating in buffer coordinates. There are several bugs to address: * A _partially_ visible selection will lead to a crash since the drawing routine converts selection coordinates to screen coordinates. The solution will be to clip the coordinates at draw time. * A selection scrolling off the buffer in either direction leads to indexing out-of-bounds. The solution again is to clip, but this needs to be done within Selection::rotate by passing a max limit. It may also need a return type to indicate that the selection is no longer visible and should be discarded. * A selection scrolling out of a logical scrolling region is not clipped. A temporary and robust workaround is to simply discard the selection in the case of scrolling in a region. wip selections fix issue with line selection selection mostly working need to support selection not being on the screen at draw time Fix selection_to_string Uncomment tests
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-06-02Style cleanupJoe Wilm
2018-06-02Fix scrolling backwards in tmuxJoe Wilm
2018-06-02Make number of scrollback lines configurableJoe Wilm
2018-06-02Scroll to bottom on character receivedJoe Wilm
2018-06-02wip fix scroll_downJoe Wilm
2018-06-02Fir cursor not scrollingJoe Wilm
2018-06-02Add scrolling limit and update on grow linesJoe Wilm
2018-06-02checkpoint: very basic scrolling worksJoe Wilm
Things that do not work - Limiting how far back in the buffer it's possible to scroll - Selections (need to transform to buffer offsets)
2018-06-02wip scrollbackJoe Wilm
2018-06-02Remove some unused implsJoe Wilm
2018-06-02Minor improvementsJoe Wilm
2018-06-02WIP optimize scroll in regionJoe Wilm
This intends to optimize the case where the top of the scrolling region is the top of the screen. In theory, scrolling in this case can be optimized to shifting the start/end of the visible region, and then rearranging any lines that were not supposed to be scrolled (at the bottom of the region). However, this didn't produce quite the speedup I expected.
2018-06-02Use memcpy for resetting row contentsJoe Wilm
In addition to a marginal performance improvement, this simplifies some logic in the Term implementation since now the Grid fully handles row recycling.
2018-06-02Remove redundant selection::Region typeJoe Wilm
The type selection::Region was defined identially to std::ops::Range. Using something other than range just served to confuse.