aboutsummaryrefslogtreecommitdiff
path: root/src/selection.rs
Commit message (Collapse)AuthorAge
* Split alacritty into a separate cratesTheodore Dubois2019-04-28
| | | | | The crate containing the entry point is called alacritty, and the crate containing everything else is called alacritty_terminal.
* Add rustfmt style guideChristian Duerr2019-03-30
|
* Add URL hover highlightingChristian Duerr2019-03-19
| | | | | | | | | | | | | | | This changes the cursor whenever it moves to a cell which contains part of a URL. When a URL is hovered over, all characters that are recognized as part of the URL will be underlined and the mouse cursor shape will be changed. After the cursor leaves the URL, the previous hover state is restored. This also changes the behavior when clicking an illegal character right in front of a URL. Previously this would still launch the URL, but strip the illegal character. Now these clicks are ignored to make sure there's no mismatch between underline and legal URL click positions
* Upgrade to Rust 2018Joe Wilm2018-12-10
| | | | | This resolves a lot of NLL issues, however full NLL will be necessary to handle a couple of remaining issues.
* Add option to open URLs on clickChristian Duerr2018-10-22
| | | | | | | | | | | | | | | | | | | | | | 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.
* Fix rotation of selection below 0Christian Duerr2018-10-20
| | | | | | | | | | | | | | 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.
* Scrollback cleanupChristian Duerr2018-07-21
| | | | | | 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.
* Remove dead codeJoe Wilm2018-06-02
|
* Improve storage comparison algorithmChristian Duerr2018-06-02
| | | | | | | | | | | 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.
* Fix BCE ref testsJoe Wilm2018-06-02
| | | | | BCE was broken in attempt to optimize row clearing. The fix is to revert to passing in the current cursor state when clearing.
* Fix selection testsChristian Duerr2018-06-02
| | | | | | | | | | | | | 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.
* Refactor `span_simple` selectionChristian Duerr2018-06-02
| | | | | | | | | | | | | 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. :)
* Fix selection starting in first cellChristian Duerr2018-06-02
| | | | | | 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.
* Fix multi-line selection with single cell endChristian Duerr2018-06-02
| | | | | | | | | | | | | | 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.
* Fix selection in scrollbackChristian Duerr2018-06-02
| | | | | | | | 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.
* Support selections with scrolling bufferJoe Wilm2018-06-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Move selection into GridJoe Wilm2018-06-02
| | | | | | | | | | | 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.
* Remove redundant selection::Region typeJoe Wilm2018-06-02
| | | | | The type selection::Region was defined identially to std::ops::Range. Using something other than range just served to confuse.
* Remove all instances of unwrap() from configChristian Duerr2018-03-04
| | | | | | | | | | | | | | | | | | 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)
* Add clippy check to travisChristian Duerr2018-01-06
| | | | This commit adds clippy as a required step of the build process. To make this possible, all existing clippy issues have been resolved.
* clippy: do and don't pass some things by reference as suggested ↵Matthias Krüger2017-12-03
| | | | (needless_pass_by_value, needless_borrow).
* fix some typos in commentsMartin Lindhe2017-10-30
|
* Update tests for new Selection APIJoe Wilm2017-06-19
|
* Fix unnecessary redraws with active selectionJoe Wilm2017-06-19
| | | | | | | Could be cleaned up a bit if there was a wrapper for Option<Selection> that contained this flag. Also fixes a few compiler warnings.
* Implement semantic and line selection draggingJoe Wilm2017-06-19
| | | | | | Unlike the regular selection that is by cell, these selection modes highlight either semantic groupings or entire lines while the mouse is dragged.
* Clippy fixes!Manish Goregaokar2017-01-06
|
* Remove need for inclusive rangesManish Goregaokar2017-01-06
|
* Fix some bugs with selectionsJoe Wilm2016-12-29
| | | | Moving the window on macOS would cause a panic in certain circumstances.
* Unify Cursor, Location and name it PointJoe Wilm2016-12-29
|
* Implement copying selection for macOSJoe Wilm2016-12-26
| | | | Still need automatic loading into selection copy buffer for linux.
* Implement visual component of mouse selectionsJoe Wilm2016-12-22
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.