Commit Graph
786 Commits
Author SHA1 Message Date
Joe Wilm 1ddb79a434 Fix BCE ref tests
BCE was broken in attempt to optimize row clearing. The fix is to revert
to passing in the current cursor state when clearing.
2018-04-02 08:44:54 -07:00
Christian Duerr da7cb69c27 Fix selection tests
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-04-02 08:29:51 -07:00
Joe Wilm 313bea4014 Fix grid scroll tests 2018-04-02 08:27:29 -07:00
Joe Wilm bc3b721a53 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-04-02 08:27:29 -07:00
Christian Duerr 9ee1cf2455 Rework auto-scrolling options
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-03-23 10:47:38 -07:00
Joe Wilm 14a76ec5c7 Fix regression with scrolling regions
Resolves #1154
2018-03-20 10:04:22 -07:00
Christian Duerr 55ba60441f Refactor span_simple selection
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-03-15 17:30:47 -07:00
Christian Duerr 70324fc6fc 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-03-15 12:27:12 -07:00
Christian Duerr e7a32b589f 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-03-15 12:27:12 -07:00
Christian Duerr d9be2d2d88 Fix selection starting in first cell
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-03-13 16:58:15 -07:00
Christian Duerr c1acbe47e6 Fix buggy selection when scrolling down
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-03-13 16:58:15 -07:00
Christian Duerr 6173603677 Fix multi-line selection with single cell end
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-03-13 16:58:15 -07:00
Christian Duerr f8e36d1663 Fix selection in scrollback
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-03-13 16:58:15 -07:00
Christian Duerr a741193bc0 Fix linux config default value 2018-03-13 14:52:14 -07:00
Christian Duerr c1e831dab0 Merge branch #1095
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-03-13 14:52:14 -07:00
Christian Duerr 290e2cfb17 Change config file to display the correct default 2018-03-13 14:52:14 -07:00
Christian Duerr 5dbe6e58b9 Make normal scrolling line amount configurable
It is now possible to configure the amount of lines the viewport should
scroll when using the normal scrolling mode.

This fixes #1160.
2018-03-13 14:52:14 -07:00
Christian Duerr fce67e6f3f 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-03-12 23:00:15 -07:00
Christian Duerr 8dd6f5c791 Disable faux scrolling when shift is pressed
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-03-12 22:55:57 -07:00
Christian Duerr f8c833ea66 Add faux_scrolling back to scrollback 2018-03-12 22:55:57 -07:00
Christian Duerr e472aa0cb4 Provide correct default for scroll_history
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-03-09 09:47:21 -08:00
Christian Duerr 52ebf3e6ec Add failure_default deserializer to scroll_history 2018-03-09 09:47:21 -08:00
Joe Wilm ec49105203 Fix 4+ line copying 2018-03-08 20:12:48 -08:00
Joe Wilm 80f46cc59f Disable LTO
It's nice to be able to use incremental compilation for release builds.

TODO quantify performance impact.
2018-03-08 20:12:22 -08:00
Joe Wilm 8520a280f7 Add SCROLL_MULTIPLIER
Scroll wheel needs some scaling so it feels like urxvt and friends.
2018-03-07 09:56:19 -08:00
Joe Wilm 143c28953c 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-03-07 09:51:51 -08:00
Joe Wilm 2cfdd595f1 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-03-07 09:51:06 -08:00
Joe Wilm 69f533d19e Style cleanup 2018-03-07 09:50:46 -08:00
Joe Wilm 40298c50e2 Fix scrolling backwards in tmux 2018-03-07 09:47:21 -08:00
Joe Wilm 5c648a34aa Make number of scrollback lines configurable 2018-03-07 09:47:21 -08:00
Joe Wilm 001b780dda Scroll to bottom on character received 2018-03-07 09:47:21 -08:00
Joe Wilm 96da93efd6 wip fix scroll_down 2018-03-07 09:47:21 -08:00
Joe Wilm 8854124ff0 Fir cursor not scrolling 2018-03-07 09:47:21 -08:00
Joe Wilm 751ef349b8 Add scrolling limit and update on grow lines 2018-03-07 09:47:21 -08:00
Joe Wilm cfc4ebfd6a 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-03-07 09:47:21 -08:00
Joe Wilm 6d1d41f8c7 wip scrollback 2018-03-07 09:46:18 -08:00
Joe Wilm 7af765502f Remove some unused impls 2018-03-07 09:46:18 -08:00
Joe Wilm debf6003b5 Minor improvements 2018-03-07 09:46:18 -08:00
Joe Wilm be89dbf30b 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-03-07 09:46:18 -08:00
Joe Wilm c954b6cb92 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-03-07 09:46:18 -08:00
Joe Wilm 2612c9b694 Remove redundant selection::Region type
The type selection::Region was defined identially to std::ops::Range.
Using something other than range just served to confuse.
2018-03-07 09:45:49 -08:00
Joe Wilm 536590dc47 Remove some unused methods and impls 2018-03-07 09:45:25 -08:00
Joe Wilm 971e4b2dc1 Eliminate ClearRegion trait 2018-03-07 09:45:25 -08:00
Joe Wilm 65fba02516 Move grid Row and tests into submodules
This is part of some cleanup for the grid module as a whole.
2018-03-07 09:45:25 -08:00
Joe Wilm 7298b58e74 Back Grid with VecDeque
VecDeque offers improved performance beyond a plain Vec for common
scrolling situations (full screen scroll). Additionally, VecDeque is
necessary for performant scrollback since recycling old rows for a Vec
would be expensive (push/pop front would shift entire vec).
2018-03-07 09:45:25 -08:00
Joe Wilm d0a58c54c5 Cleanup style 2018-03-07 09:45:25 -08:00
Christian Duerr 7f2b398ad2 Remove all instances of unwrap() from config
Unwrapping inside the config file parsing can lead to some issues that
prevent us from falling back to a default configuration file.

One instance of that issue was mentioned in #1135.

Now all instances of `unwrap()` have been removed and replaced with
proper error handling. This will make the config more robust and
prevents live reload from silently breaking while alacritty is running.

This also fixes a few currently existing clippy issues.
Clippy added an additonal lint which complains about `MyStruct { field:
field }`.

These issues have been fixed, except for some false-positives and issues
in external macros which will probably be fixed with future updates (rust-lang-nursery/bitflags#149)
2018-03-04 22:40:15 +00:00
Andy Lok 475ebecfc4 Update arraydeque dependency 2018-02-28 20:33:29 +00:00
Sam Rijs 8045737d58 Upgrade dependencies
Upgrading glutin to the latest version allows building alacritty even
with old XRandr versions.

This is relevant for Debian machines (and other ancient systems).
2018-02-28 19:52:42 +00:00
MindTooth 0afc86cba0 Fix heading for NixOS/Nixpkgs
The level of heading were one to high.
2018-02-27 18:57:19 -08:00