aboutsummaryrefslogtreecommitdiff
path: root/src/selection.rs
AgeCommit message (Collapse)Author
2018-10-22Add option to open URLs on clickChristian Duerr
This adds the option to automatically launch URLs with a specified program when clicking on them. The config option `mouse.url_launcher` has been added to specify which program should be used to open the URL. The URL is always passed as the last parameter to the specified command. It is not always desired for URLs to open automatically when clicking on them. To resolve this a new `modifiers` field has been introduced to the config, which allows specifying which keyboard modifiers need to be held down to launch URLs in the specified launcher. Some tests have been added to make sure that the edge-cases of the URL parsing are protected against future regressions. To make testing easier the parsing method has been moved into the `SemanticSearch` trait. The name of the trait has also been changed to just `Search` and it has been moved to `src/term/mod.rs` to fit the additional functionality. This fixes #113.
2018-10-20Fix rotation of selection below 0Christian Duerr
Whenever the viewport is scrolled, the selection is rotated to make sure that it moves with the viewport. However this did not correctly handle the underflow that happens when the selection goes below 0. This resolves that problem for the selection by moving the internal line representation to an isize, thus correctly keeping track of the selection start/end points even when they have a negative index. Once the selection is converted to a span, the lines are clamped to the visible region. This fixes #1640 and fixes #1643.
2018-07-21Scrollback cleanupChristian Duerr
There were some unneeded codeblocks and TODO/XXX comments in the code that have been removed. All issues marked with TODO/XXX have either been already resolved or tracking issues exist.
2018-06-02Remove dead codeJoe Wilm
2018-06-02Improve storage comparison algorithmChristian Duerr
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.
2018-06-02Fix BCE ref testsJoe Wilm
BCE was broken in attempt to optimize row clearing. The fix is to revert to passing in the current cursor state when clearing.
2018-06-02Fix selection testsChristian Duerr
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-06-02Refactor `span_simple` selectionChristian Duerr
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-06-02Fix selection starting in first cellChristian Duerr
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-06-02Fix multi-line selection with single cell endChristian Duerr
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-06-02Fix selection in scrollbackChristian Duerr
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-06-02Support selections with scrolling bufferJoe Wilm
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-02Move selection into GridJoe Wilm
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-02Remove redundant selection::Region typeJoe Wilm
The type selection::Region was defined identially to std::ops::Range. Using something other than range just served to confuse.
2018-03-04Remove all instances of unwrap() from configChristian Duerr
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-01-06Add clippy check to travisChristian Duerr
This commit adds clippy as a required step of the build process. To make this possible, all existing clippy issues have been resolved.
2017-12-03clippy: do and don't pass some things by reference as suggested ↵Matthias Krüger
(needless_pass_by_value, needless_borrow).
2017-10-30fix some typos in commentsMartin Lindhe
2017-06-19Update tests for new Selection APIJoe Wilm
2017-06-19Fix unnecessary redraws with active selectionJoe Wilm
Could be cleaned up a bit if there was a wrapper for Option<Selection> that contained this flag. Also fixes a few compiler warnings.
2017-06-19Implement semantic and line selection draggingJoe Wilm
Unlike the regular selection that is by cell, these selection modes highlight either semantic groupings or entire lines while the mouse is dragged.
2017-01-06Clippy fixes!Manish Goregaokar
2017-01-06Remove need for inclusive rangesManish Goregaokar
2016-12-29Fix some bugs with selectionsJoe Wilm
Moving the window on macOS would cause a panic in certain circumstances.
2016-12-29Unify Cursor, Location and name it PointJoe Wilm
2016-12-26Implement copying selection for macOSJoe Wilm
Still need automatic loading into selection copy buffer for linux.
2016-12-22Implement visual component of mouse selectionsJoe Wilm
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.