diff options
author | Joe Wilm <joe@jwilm.com> | 2018-03-06 20:57:40 -0800 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2018-06-02 09:34:28 -0700 |
commit | 8018dee1812ab88793c0f18e13335fa77c068000 (patch) | |
tree | 3d9a4a5435a1bdfe260ea78299f49d8934535b6b /src/index.rs | |
parent | 8ef062efd94975885776e61b6df936088b018da0 (diff) | |
download | alacritty-8018dee1812ab88793c0f18e13335fa77c068000.tar.gz alacritty-8018dee1812ab88793c0f18e13335fa77c068000.zip |
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
Diffstat (limited to 'src/index.rs')
-rw-r--r-- | src/index.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/index.rs b/src/index.rs index 418faff2..ada5f5b1 100644 --- a/src/index.rs +++ b/src/index.rs @@ -28,13 +28,13 @@ pub enum Side { /// Index in the grid using row, column notation #[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Serialize, Deserialize, PartialOrd)] -pub struct Point { - pub line: Line, +pub struct Point<L=Line> { + pub line: L, pub col: Column, } -impl Point { - pub fn new(line: Line, col: Column) -> Point { +impl<L> Point<L> { + pub fn new(line: L, col: Column) -> Point<L> { Point { line, col } } } |