Commit Graph

22 Commits

Author SHA1 Message Date
Joe Wilm b0f655ac85 Make tests compile again
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-02 09:56:50 -07:00
Joe Wilm 4333b2fb19 Fix regression with scrolling regions
Resolves #1154
2018-06-02 09:56:50 -07:00
Christian Duerr 0dcb9ca6a8 Replace scrolling methods with enum
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-02 09:56:50 -07:00
Christian Duerr 2c7bb9a4d3 Add scrollback hotkeys
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-02 09:56:50 -07:00
Christian Duerr 231ef51365 Fix crash when selection leaves viewport
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-02 09:42:08 -07:00
Joe Wilm 8018dee181 Support selections with scrolling buffer
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-02 09:34:28 -07:00
Joe Wilm 8ef062efd9 Move selection into Grid
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-02 09:34:28 -07:00
Joe Wilm 54d50ed3be Fix scrolling backwards in tmux 2018-06-02 09:32:29 -07:00
Joe Wilm c49a7e88f6 Make number of scrollback lines configurable 2018-06-02 09:32:29 -07:00
Joe Wilm 7fe67743eb Scroll to bottom on character received 2018-06-02 09:32:29 -07:00
Joe Wilm f67b17ca7b wip fix scroll_down 2018-06-02 09:32:29 -07:00
Joe Wilm 9b9b138bac Fir cursor not scrolling 2018-06-02 09:32:29 -07:00
Joe Wilm 5748066b8a Add scrolling limit and update on grow lines 2018-06-02 09:32:29 -07:00
Joe Wilm 45c2b3fbf7 checkpoint: very basic scrolling works
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-02 09:32:29 -07:00
Joe Wilm 94796a70fc wip scrollback 2018-06-02 09:24:38 -07:00
Joe Wilm 84769ce170 Remove some unused impls 2018-06-02 09:24:38 -07:00
Joe Wilm 92b11cfa43 Minor improvements 2018-06-02 09:24:38 -07:00
Joe Wilm f13685918f WIP optimize scroll in region
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-02 09:24:38 -07:00
Joe Wilm 350bb8c800 Use memcpy for resetting row contents
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-02 09:24:38 -07:00
Joe Wilm 4ed25009c4 Remove some unused methods and impls 2018-06-02 09:24:38 -07:00
Joe Wilm 6fc0e1ec49 Eliminate ClearRegion trait 2018-06-02 09:24:38 -07:00
Joe Wilm 277425956f Move grid Row and tests into submodules
This is part of some cleanup for the grid module as a whole.
2018-06-02 09:24:38 -07:00