aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyose <ayosec@gmail.com>2021-06-21 00:20:53 +0100
committerAyose <ayosec@gmail.com>2021-06-21 00:20:53 +0100
commit699a7a9d13fd741bf4430514ac8d6f579a68484a (patch)
tree210c5832cc29bc91b0129b07fdfd2bacd5611d67
parent3caa09ef9b339ebed1329eed016b8a5704bd2c77 (diff)
parentfa2fa39804fd0e170d0293b442390ae189503856 (diff)
downloadr-alacritty-699a7a9d13fd741bf4430514ac8d6f579a68484a.tar.gz
r-alacritty-699a7a9d13fd741bf4430514ac8d6f579a68484a.tar.bz2
r-alacritty-699a7a9d13fd741bf4430514ac8d6f579a68484a.zip
Merge remote-tracking branch 'vendor/master' into graphics
-rw-r--r--CHANGELOG.md2
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--README.md2
-rw-r--r--alacritty.yml4
-rw-r--r--alacritty/src/config/bindings.rs9
-rw-r--r--alacritty/src/config/ui_config.rs9
-rw-r--r--alacritty_terminal/src/term/search.rs41
-rw-r--r--alacritty_terminal/src/vi_mode.rs2
8 files changed, 54 insertions, 17 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 223dbdec..4ad3d89a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,11 +10,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- Support for `ipfs`/`ipns` URLs
+- Mode field for regex hint bindings
### Fixed
- Regression in rendering performance with dense grids since 0.6.0
- Crash/Freezes with partially visible fullwidth characters due to alt screen resize
+- Incorrect vi cursor position after invoking `ScrollPageHalfUp` action
## 0.8.0
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 068712dc..351bb5de 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -161,4 +161,4 @@ If there are any outstanding questions about contributing to Alacritty, they can
[Alacritty issue tracker](https://github.com/alacritty/alacritty/issues).
As a more immediate and direct form of communication, the Alacritty IRC channel (`#alacritty` on
-Freenode) can be used to contact many of the Alacritty contributors.
+Libera.Chat) can be used to contact many of the Alacritty contributors.
diff --git a/README.md b/README.md
index 70aec5f6..479764cd 100644
--- a/README.md
+++ b/README.md
@@ -104,7 +104,7 @@ niceties like a GUI config editor.
## IRC
-Alacritty discussions can be found in `#alacritty` on freenode.
+Alacritty discussions can be found in `#alacritty` on Libera.Chat.
## License
diff --git a/alacritty.yml b/alacritty.yml
index 8f4f5218..21f06fd0 100644
--- a/alacritty.yml
+++ b/alacritty.yml
@@ -458,8 +458,8 @@
# Each hint must have a `regex` and either an `action` or a `command` field.
# The fields `mouse`, `binding` and `post_processing` are optional.
#
- # The fields `command`, `binding.key`, `binding.mods` and `mouse.mods` accept
- # the same values as they do in the `key_bindings` section.
+ # The fields `command`, `binding.key`, `binding.mods`, `binding.mode` and
+ # `mouse.mods` accept the same values as they do in the `key_bindings` section.
#
# The `mouse.enabled` field controls if the hint should be underlined while
# the mouse with all `mouse.mods` keys held or the vi mode cursor is above it.
diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs
index 4e7c2fcb..12349639 100644
--- a/alacritty/src/config/bindings.rs
+++ b/alacritty/src/config/bindings.rs
@@ -726,7 +726,8 @@ impl<'a> Deserialize<'a> for Key {
}
}
-struct ModeWrapper {
+#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+pub struct ModeWrapper {
pub mode: BindingMode,
pub not_mode: BindingMode,
}
@@ -754,6 +755,12 @@ impl BindingMode {
}
}
+impl Default for ModeWrapper {
+ fn default() -> Self {
+ Self { mode: BindingMode::empty(), not_mode: BindingMode::empty() }
+ }
+}
+
impl<'a> Deserialize<'a> for ModeWrapper {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs
index 460eebb0..a58c1fd3 100644
--- a/alacritty/src/config/ui_config.rs
+++ b/alacritty/src/config/ui_config.rs
@@ -14,7 +14,7 @@ use alacritty_terminal::term::search::RegexSearch;
use crate::config::bell::BellConfig;
use crate::config::bindings::{
- self, Action, Binding, BindingMode, Key, KeyBinding, ModsWrapper, MouseBinding,
+ self, Action, Binding, Key, KeyBinding, ModeWrapper, ModsWrapper, MouseBinding,
};
use crate::config::color::Colors;
use crate::config::debug::Debug;
@@ -105,8 +105,8 @@ impl UiConfig {
let binding = KeyBinding {
trigger: binding.key,
mods: binding.mods.0,
- mode: BindingMode::empty(),
- notmode: BindingMode::empty(),
+ mode: binding.mode.mode,
+ notmode: binding.mode.not_mode,
action: Action::Hint(hint.clone()),
};
@@ -242,6 +242,7 @@ impl Default for Hints {
binding: Some(HintBinding {
key: Key::Keycode(VirtualKeyCode::U),
mods: ModsWrapper(ModifiersState::SHIFT | ModifiersState::CTRL),
+ mode: Default::default(),
}),
}],
alphabet: Default::default(),
@@ -340,6 +341,8 @@ pub struct HintBinding {
pub key: Key,
#[serde(default)]
pub mods: ModsWrapper,
+ #[serde(default)]
+ pub mode: ModeWrapper,
}
/// Hint mouse highlighting.
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
index fd90f0e1..bf7f43d1 100644
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -239,12 +239,7 @@ impl<T> Term<T> {
}
// Stop once we've reached the target point.
- //
- // We check beyond the point itself to account for skipped characters after wide chars
- // without spacer.
- if (direction == Direction::Right && point >= end)
- || (direction == Direction::Left && point <= end)
- {
+ if point == end {
break;
}
@@ -289,9 +284,14 @@ impl<T> Term<T> {
direction: Direction,
) {
match direction {
- Direction::Right if cell.flags.contains(Flags::WIDE_CHAR) => {
+ // In the alternate screen buffer there might not be a wide char spacer after a wide
+ // char, so we only advance the iterator when the wide char is not in the last column.
+ Direction::Right
+ if cell.flags.contains(Flags::WIDE_CHAR)
+ && iter.point().column < self.last_column() =>
+ {
iter.next();
- },
+ }
Direction::Right if cell.flags.contains(Flags::LEADING_WIDE_CHAR_SPACER) => {
if let Some(Indexed { cell: new_cell, .. }) = iter.next() {
*cell = new_cell;
@@ -798,4 +798,29 @@ mod tests {
let mut iter = RegexIter::new(start, end, Direction::Right, &term, &dfas);
assert_eq!(iter.next(), None);
}
+
+ #[test]
+ fn wrap_around_to_another_end() {
+ #[rustfmt::skip]
+ let term = mock_term("\
+ abc\r\n\
+ def\
+ ");
+
+ // Bottom to top.
+ let dfas = RegexSearch::new("abc").unwrap();
+ let start = Point::new(Line(1), Column(0));
+ let end = Point::new(Line(0), Column(2));
+ let match_start = Point::new(Line(0), Column(0));
+ let match_end = Point::new(Line(0), Column(2));
+ assert_eq!(term.regex_search_right(&dfas, start, end), Some(match_start..=match_end));
+
+ // Top to bottom.
+ let dfas = RegexSearch::new("def").unwrap();
+ let start = Point::new(Line(0), Column(2));
+ let end = Point::new(Line(1), Column(0));
+ let match_start = Point::new(Line(1), Column(0));
+ let match_end = Point::new(Line(1), Column(2));
+ assert_eq!(term.regex_search_left(&dfas, start, end), Some(match_start..=match_end));
+ }
}
diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs
index 54229998..6f370642 100644
--- a/alacritty_terminal/src/vi_mode.rs
+++ b/alacritty_terminal/src/vi_mode.rs
@@ -170,7 +170,7 @@ impl ViModeCursor {
};
// Clamp movement to within visible region.
- let line = (self.point.line - overscroll).grid_clamp(term, Boundary::Cursor);
+ let line = (self.point.line - overscroll).grid_clamp(term, Boundary::Grid);
// Find the first occupied cell after scrolling has been performed.
let target_line = (self.point.line - lines).grid_clamp(term, Boundary::Grid);