Age | Commit message (Collapse) | Author |
|
This implementation avoids a few extra transformations by operating in
buffer-space. However, there is still a transformation from the logical
buffer-space to the underlying vector.
|
|
When resizing prior to this patch, hidden rows in Storage were not
having columns added along with everything else. This feels like a bit
of tech debt, but the patch is simple enough that it won't be much extra
to back out later when the underlying cause is addressed (see comments
in code).
|
|
Because there is no good way to store invisible lines in a backwards-
and forwards-compatible way, they buffer now gets truncated before
dumping the state of a grid when creating a ref-test.
This involved a few workaround of which a few required adding additional
methods which are only used in ref-tests, these should be minimal
though.
Since this required the creation of a truncation method anyways, some
logic has been added which automatically truncates the invisible buffer
when there are more than X (set to 100) invisible lines. This should not
impact performance because it rarely occurs, but it could save a bit of
memory when the history size is shrunk during runtime (see #1293).
This also adds an optional `config.json` file to the ref-test output
where it is possible to manually specify variables which should override
config defaults, this has been used only for history_size so far.
Creating a new ref-test does also still work, so there was no regression
here, if history size is altered, the config.json just has to be created
manually with the content `{"history_size":HIST_SIZE}`, where
`HIST_SIZE` is the desired history size.
|
|
Since every line is allocated at startup anyways, the `push` method on
`Storage` has been removed and instead of pushing to the vector the
initialization has been moved to the `with_capacity` method.
This has the advantage that we don't need to keep track of the `len` in
push (like adding one), but we just need to worry about
growing/shrinking the visible area.
|
|
Until now the resizing implementation with scrollback has been really
inefficient because it made use of APIs like `Vec::insert`. This has
been rewored with this commit.
A `len` property has been added to the `Storage` struct which keeps
track of the actual length of the raw buffer. This has changed both
shrinking and growing implementations.
With shrinking, no more lines are removed, only the `len` property is
updated to set all lines shrunk to an "invisible" state which cannot be
accessed from the outside, this effectively changes it to a O(1)
operation. The only issue with this would be memory consumption, but
since the maximum shrinkage is the number of lines on one screen, it
should be a rather small impacte (probabl <100 lines usually). If
desired it would be possible to change this to shrink the raw inner
buffer whenever there are more than X lines hidden.
Growing now works in a similar way to shrinking, if the "invisible"
lines are enough, no new lines are inserted but rather the invisible
buffer is made visible again. Otherwise the amount of lines that still
needs to be inserted is added to the raw buffer, but instead of the
inefficient `Vec::insert`, the `Vec::push` API is used now.
This fixes #1271.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
This reverts commit 54b21b66ecc6f8f149d1425567e0e3d766a3ac54.
|
|
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.
|
|
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.
|
|
|
|
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.
|
|
BCE was broken in attempt to optimize row clearing. The fix is to revert
to passing in the current cursor state when clearing.
|
|
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.
|
|
Resolves #1154
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Things that do not work
- Limiting how far back in the buffer it's possible to scroll
- Selections (need to transform to buffer offsets)
|
|
|
|
|
|
|
|
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.
|
|
In addition to a marginal performance improvement, this simplifies some
logic in the Term implementation since now the Grid fully handles row
recycling.
|
|
|
|
|
|
This is part of some cleanup for the grid module as a whole.
|