Commit Graph

14 Commits

Author SHA1 Message Date
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
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
Christian Duerr 2920cbe710
Add clippy check to travis
This commit adds clippy as a required step of the build process. To make
this possible, all existing clippy issues have been resolved.
2018-01-06 01:42:55 +00:00
Manish Goregaokar 4e1f4c8cd7 Clippy fixes! 2017-01-06 20:44:51 -08:00
Manish Goregaokar fbeded8ac5 Remove need for inclusive ranges 2017-01-06 20:28:17 -08:00
Manish Goregaokar c579d07993 Remove need for range_contains feature 2017-01-06 20:17:10 -08:00
Manish Goregaokar 800b65622c Remove need for step_by feature 2017-01-06 20:17:10 -08:00
Joe Wilm 82bfc41af7 Add support for SGR mouse reporting
According to:
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
2017-01-01 18:28:49 -08:00
Joe Wilm 689e0f4ad7 Unify Cursor, Location and name it Point 2016-12-29 11:09:29 -05:00
Joe Wilm 6e708d2119 Implement visual component of mouse selections
This adds the ability to click and drag with the mouse and have the
effect of visually selecting text. The ability to copy the selection
into a clipboard buffer is not yet implemented.
2016-12-22 13:44:13 -05:00
Joe Wilm 66dbd29cd1 Add support for recording/running ref tests
Ref tests use a recording of the terminal protocol and a serialization
of the grid state to check that the parsing and action handling systems
produce the correct result. Ref tests may be recorded by running
alacritty with `--ref-test` and closing the terminal by using the window
"X" button. At that point, the recording is fully written to disk, and a
serialization of important state is recorded. Those files should be
moved to an appropriate folder in the `tests/ref/` tree, and the
`ref_test!` macro invocation should be updated accordingly.

A couple of changes were necessary to make this work:

* Ref tests shouldn't create a pty; the pty was refactored out of the
  `Term` type.
* Repeatable lines/cols were needed; on startup, the terminal is resized
* by default to 80x24 though that may be changed by passing
  `--dimensions w h`.
* Calculating window size based on desired rows/columns and font metrics
  required making load_font callable multiple times.
* Refactor types into library crate so they may be imported in an
  integration test.
* A whole bunch of types needed symmetric serialization and
  deserialization. Mostly this was just adding derives, but the custom
  deserialization of Rgb had to change to a deserialize_with function.

This initially adds one ref test as a sanity check, and more will be
added in subsequent commits. This initial ref tests just starts the
terminal and runs `ll`.
2016-11-19 21:34:11 -08:00
Joe Wilm 3c5d46c851 Scrolling v2
The previous scrolling + scroll region implementation exhibited display
corruption bugs in several applications including tmux, irssi, htop, and
vim. The new implementation doesn't seem to suffer from any of those
issues.

This implementation is able to `find /usr` on my machine (nearly 600k
lines) in ~2.0 seconds while st is able to do the same in ~2.2 seconds.
Alacritty is officially faster!
2016-08-22 08:37:50 -07:00
Joe Wilm 80f6f542ab Update to latest nightly
Previous version of serde no longer worked; cargo packages were updated
as a result. `Zero` and `One` traits were deprecated. Use of those was
removed. The `Step` trait gained a lot more methods, and the index::$ty
implementations were updated.
2016-07-15 07:55:44 -07:00
Joe Wilm 6639e6f24f Move ::grid::index to ::index
The grid and term modules already rely on the index types, and ansi is
about to be updated with strongly typed APIs. Since Cursor, Line, and
Column are fundamental to the code in several modules, namespacing them
under one of them seems less correct than a module that stands by
itself.
2016-07-03 21:07:58 -07:00