aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/grid
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-03-18 02:35:08 +0000
committerGitHub <noreply@github.com>2020-03-18 02:35:08 +0000
commit1a8cd172e520e493bacc9c6a2ae6f80de086eaa3 (patch)
tree0b837f1f52f72fe00e258afc34094d60b5d18f04 /alacritty_terminal/src/grid
parent64db7d3daaed4e06fb8292227622bbc4cdaa2cf0 (diff)
downloadalacritty-1a8cd172e520e493bacc9c6a2ae6f80de086eaa3.tar.gz
alacritty-1a8cd172e520e493bacc9c6a2ae6f80de086eaa3.zip
Add modal keyboard motion mode
This implements a basic mode for navigating inside of Alacritty's history with keyboard bindings. They're bound by default to vi's motion shortcuts but are fully customizable. Since this relies on key bindings only single key bindings are currently supported (so no `ge`, or repetition). Other than navigating the history and moving the viewport, this mode should enable making use of all available selection modes to copy content to the clipboard and launch URLs below the cursor. This also changes the rendering of the block cursor at the side of selections, since previously it could be inverted to be completely invisible. Since that would have caused some troubles with this keyboard selection mode, the block cursor now is no longer inverted when it is at the edges of a selection. Fixes #262.
Diffstat (limited to 'alacritty_terminal/src/grid')
-rw-r--r--alacritty_terminal/src/grid/mod.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/alacritty_terminal/src/grid/mod.rs b/alacritty_terminal/src/grid/mod.rs
index 34d989db..37cf0eb6 100644
--- a/alacritty_terminal/src/grid/mod.rs
+++ b/alacritty_terminal/src/grid/mod.rs
@@ -264,11 +264,9 @@ impl<T: GridCell + PartialEq + Copy> Grid<T> {
let mut new_empty_lines = 0;
let mut reversed: Vec<Row<T>> = Vec::with_capacity(self.raw.len());
for (i, mut row) in self.raw.drain().enumerate().rev() {
- // FIXME: Rust 1.39.0+ allows moving in pattern guard here
// Check if reflowing shoud be performed
- let mut last_row = reversed.last_mut();
- let last_row = match last_row {
- Some(ref mut last_row) if should_reflow(last_row) => last_row,
+ let last_row = match reversed.last_mut() {
+ Some(last_row) if should_reflow(last_row) => last_row,
_ => {
reversed.push(row);
continue;
@@ -356,11 +354,9 @@ impl<T: GridCell + PartialEq + Copy> Grid<T> {
}
loop {
- // FIXME: Rust 1.39.0+ allows moving in pattern guard here
// Check if reflowing shoud be performed
- let wrapped = row.shrink(cols);
- let mut wrapped = match wrapped {
- Some(_) if reflow => wrapped.unwrap(),
+ let mut wrapped = match row.shrink(cols) {
+ Some(wrapped) if reflow => wrapped,
_ => {
new_raw.push(row);
break;