repo stringlengths 8 35 | pull_number int64 14 15.2k | instance_id stringlengths 13 40 | issue_numbers sequencelengths 1 3 | base_commit stringlengths 40 40 | patch stringlengths 274 342k | test_patch stringlengths 308 274k | problem_statement stringlengths 25 44.3k | hints_text stringlengths 0 33.6k | created_at stringlengths 19 30 | version stringlengths 3 5 | environment_setup_commit stringlengths 40 40 | FAIL_TO_PASS sequencelengths 1 1.1k | PASS_TO_PASS sequencelengths 0 7.38k | FAIL_TO_FAIL sequencelengths 0 1.72k | PASS_TO_FAIL sequencelengths 0 49 | __index_level_0__ int64 0 689 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sigoden/aichat | 1,056 | sigoden__aichat-1056 | [
"1055"
] | 737580bb87f3b1d2f040dd7a4ddacca3595915a0 | diff --git a/src/cli.rs b/src/cli.rs
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -73,12 +73,7 @@ pub struct Cli {
impl Cli {
pub fn text(&self) -> Option<String> {
- let text = self
- .text
- .iter()
- .map(|x| x.trim().to_string())
- .collect::<Vec<String>>()
- .join(" ");
+ let text = self.text.to_vec().join(" ");
if text.is_empty() {
return None;
}
diff --git a/src/config/input.rs b/src/config/input.rs
--- a/src/config/input.rs
+++ b/src/config/input.rs
@@ -91,7 +91,7 @@ impl Input {
}
for (path, contents) in files {
texts.push(format!(
- "============ PATH: {path} ============\n\n{contents}\n"
+ "============ PATH: {path} ============\n{contents}\n"
));
}
let (role, with_session, with_agent) = resolve_role(&config.read(), role);
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -280,7 +280,7 @@ impl Repl {
Some(args) => match args.split_once(['\n', ' ']) {
Some((name, text)) => {
let role = self.config.read().retrieve_role(name.trim())?;
- let input = Input::from_str(&self.config, text.trim(), Some(role));
+ let input = Input::from_str(&self.config, text, Some(role));
ask(&self.config, self.abort_signal.clone(), input, false).await?;
}
None => {
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -718,8 +718,9 @@ fn split_files_text(line: &str, is_win: bool) -> (Vec<String>, &str) {
word.to_string()
}
};
+ let chars: Vec<char> = line.chars().collect();
- for (i, char) in line.chars().enumerate() {
+ for (i, char) in chars.iter().cloned().enumerate() {
match unbalance {
Some(ub_char) if ub_char == char => {
word.push(char);
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -730,12 +731,15 @@ fn split_files_text(line: &str, is_win: bool) -> (Vec<String>, &str) {
}
None => match char {
' ' | '\t' | '\r' | '\n' => {
+ if char == '\r' && chars.get(i + 1) == Some(&'\n') {
+ continue;
+ }
if let Some('\\') = prev_char.filter(|_| !is_win) {
word.push(char);
} else if !word.is_empty() {
if word == "--" {
word.clear();
- text_starts_at = Some(i);
+ text_starts_at = Some(i + 1);
break;
}
words.push(unquote_word(&word));
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -763,7 +767,7 @@ fn split_files_text(line: &str, is_win: bool) -> (Vec<String>, &str) {
words.push(unquote_word(&word));
}
let text = match text_starts_at {
- Some(start) => line[start..].trim(),
+ Some(start) => &line[start..],
None => "",
};
| diff --git a/src/repl/mod.rs b/src/repl/mod.rs
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -807,6 +811,10 @@ mod tests {
split_files_text("file.txt -- hello", false),
(vec!["file.txt".into()], "hello")
);
+ assert_eq!(
+ split_files_text("file.txt -- \thello", false),
+ (vec!["file.txt".into()], "\thello")
+ );
assert_eq!(
split_files_text("file.txt --\nhello", false),
(vec!["file.txt".into()], "hello")
| Unable to define a grammar check that keeps indentation.
**Describe the bug**
When passing a string via argument, or STDIN, whitespace is trimmed in my role.
**To Reproduce**
I edited the grammar role example, and tried to make it work with code comments and indentation (I pipe strings from my editor to aichat, and need it to keep the formatting). This is my role:
```markdown
---
model: claude:claude-3-5-sonnet-latest
temperature: 0
top_p: 0
---
Your task is to take the text provided and rewrite it into a clear, grammatically
correct version while preserving the original meaning as closely as possible.
Correct any spelling mistakes, punctuation errors, verb tense issues, word choice
problems, and other grammatical mistakes.
It is possible that what you get is not just text, but markdown, code comments,
HTML, or something like that. In any case, I want you to only edit the text,
not the function (that is, do not spell check the function or variable names,
only the comments).
The rest should be returned as-is, including indentation and any
other extra white-space before text.
```
When I call it via stdin/args it does not work as expected however:
```shell
$ echo ' this is a problem' | aichat --role grammar
This is a problem.
$ aichat --role grammar --code ' this is a porblem'
This is a problem.
```
I assume I'm doing something wrong with `aichat`, or with my role definition, sorry if this is documented somehwere that I'm not aware of.
**Expected behavior**
The grammar check should preserve white-space.
**Configuration**
```
aichat --info
model claude:claude-3-5-sonnet-latest
max_output_tokens 8192 (current model)
temperature -
top_p -
dry_run false
stream true
save false
keybindings emacs
wrap no
wrap_code false
function_calling true
use_tools -
agent_prelude -
save_session -
compress_threshold 4000
rag_reranker_model -
rag_top_k 5
highlight true
light_theme false
config_file /Users/denis/.dotfiles/aichat/config.yaml
env_file /Users/denis/.dotfiles/aichat/.env
roles_dir /Users/denis/.dotfiles/aichat/roles
sessions_dir /Users/denis/.dotfiles/aichat/sessions
rags_dir /Users/denis/.dotfiles/aichat/rags
functions_dir /Users/denis/.dotfiles/aichat/functions
messages_file /Users/denis/.dotfiles/aichat/messages.md
```
**Environment (please complete the following information):**
- macOS 15.1
- aichat 0.24.0
- alacritty 0.14.0
| 2024-12-14T06:50:17 | 0.25 | 737580bb87f3b1d2f040dd7a4ddacca3595915a0 | [
"repl::tests::test_split_files_text"
] | [
"config::role::tests::test_merge_prompt_name",
"config::role::tests::test_parse_structure_prompt1",
"config::role::tests::test_parse_structure_prompt2",
"config::role::tests::test_parse_structure_prompt3",
"config::role::tests::test_match_name",
"client::stream::tests::test_json_stream_ndjson",
"rag::sp... | [] | [] | 0 | |
alacritty/alacritty | 8,356 | alacritty__alacritty-8356 | [
"8314",
"8268"
] | 22a447573bbd67c0a5d3946d58d6d61bac3b4ad2 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
Notable changes to the `alacritty_terminal` crate are documented in its
[CHANGELOG](./alacritty_terminal/CHANGELOG.md).
+## 0.14.1-rc1
+
+### Changed
+
+- Always emit `1` for the first parameter when having modifiers in kitty keyboard protocol
+
+### Fixed
+
+- Mouse/Vi cursor hint highlighting broken on the terminal cursor line
+- Hint launcher opening arbitrary text, when terminal content changed while opening
+- `SemanticRight`/`SemanticLeft` vi motions breaking with wide semantic escape characters
+- `alacritty migrate` crashing with recursive toml imports
+- Migrating nonexistent toml import breaking the entire migration
+- Crash when pressing certain modifier keys on macOS 15+
+- First daemon mode window ignoring window options passed through CLI
+
## 0.14.0
### Packaging
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -32,7 +32,7 @@ dependencies = [
[[package]]
name = "alacritty"
-version = "0.14.0"
+version = "0.14.1-rc1"
dependencies = [
"ahash",
"alacritty_config",
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -92,7 +92,7 @@ dependencies = [
[[package]]
name = "alacritty_terminal"
-version = "0.24.1"
+version = "0.24.2-rc1"
dependencies = [
"base64",
"bitflags 2.6.0",
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -966,10 +966,11 @@ dependencies = [
[[package]]
name = "js-sys"
-version = "0.3.69"
+version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
+checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7"
dependencies = [
+ "once_cell",
"wasm-bindgen",
]
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2096,23 +2097,23 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
-version = "0.2.92"
+version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
+checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396"
dependencies = [
"cfg-if",
+ "once_cell",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.92"
+version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
+checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79"
dependencies = [
"bumpalo",
"log",
- "once_cell",
"proc-macro2",
"quote",
"syn",
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2121,21 +2122,22 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.42"
+version = "0.4.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
+checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2"
dependencies = [
"cfg-if",
"js-sys",
+ "once_cell",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.92"
+version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
+checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2143,9 +2145,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.92"
+version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
+checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2"
dependencies = [
"proc-macro2",
"quote",
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2156,9 +2158,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.92"
+version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
+checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6"
[[package]]
name = "wayland-backend"
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2271,9 +2273,9 @@ dependencies = [
[[package]]
name = "web-sys"
-version = "0.3.69"
+version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
+checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc"
dependencies = [
"js-sys",
"wasm-bindgen",
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2536,9 +2538,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winit"
-version = "0.30.4"
+version = "0.30.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4225ddd8ab67b8b59a2fee4b34889ebf13c0460c1c3fa297c58e21eb87801b33"
+checksum = "dba50bc8ef4b6f1a75c9274fb95aa9a8f63fbc66c56f391bd85cf68d51e7b1a3"
dependencies = [
"ahash",
"android-activity",
diff --git a/INSTALL.md b/INSTALL.md
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -84,7 +84,7 @@ to build Alacritty. Here's an apt command that should install all of them. If
something is still found to be missing, please open an issue.
```sh
-apt install cmake pkg-config libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev libxkbcommon-dev python3
+apt install cmake g++ pkg-config libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev libxkbcommon-dev python3
```
#### Arch Linux
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "alacritty"
-version = "0.14.0"
+version = "0.14.1-rc1"
authors = ["Christian Duerr <contact@christianduerr.com>", "Joe Wilm <joe@jwilm.com>"]
license = "Apache-2.0"
description = "A fast, cross-platform, OpenGL terminal emulator"
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -12,7 +12,7 @@ rust-version = "1.74.0"
[dependencies.alacritty_terminal]
path = "../alacritty_terminal"
-version = "0.24.1"
+version = "0.24.2-rc1"
[dependencies.alacritty_config_derive]
path = "../alacritty_config_derive"
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -41,7 +41,7 @@ tempfile = "3.12.0"
toml = "0.8.2"
toml_edit = "0.22.21"
unicode-width = "0.1"
-winit = { version = "0.30.4", default-features = false, features = ["rwh_06", "serde"] }
+winit = { version = "0.30.7", default-features = false, features = ["rwh_06", "serde"] }
[build-dependencies]
gl_generator = "0.14.0"
diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs
--- a/alacritty/src/config/bindings.rs
+++ b/alacritty/src/config/bindings.rs
@@ -5,6 +5,7 @@ use std::fmt::{self, Debug, Display};
use bitflags::bitflags;
use serde::de::{self, Error as SerdeError, MapAccess, Unexpected, Visitor};
use serde::{Deserialize, Deserializer};
+use std::rc::Rc;
use toml::Value as SerdeValue;
use winit::event::MouseButton;
use winit::keyboard::{
diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs
--- a/alacritty/src/config/bindings.rs
+++ b/alacritty/src/config/bindings.rs
@@ -96,7 +97,7 @@ pub enum Action {
/// Regex keyboard hints.
#[config(skip)]
- Hint(Hint),
+ Hint(Rc<Hint>),
/// Move vi mode cursor.
#[config(skip)]
diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs
--- a/alacritty/src/config/bindings.rs
+++ b/alacritty/src/config/bindings.rs
@@ -790,7 +791,7 @@ impl<'a> Deserialize<'a> for ModeWrapper {
{
struct ModeVisitor;
- impl<'a> Visitor<'a> for ModeVisitor {
+ impl Visitor<'_> for ModeVisitor {
type Value = ModeWrapper;
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs
--- a/alacritty/src/config/bindings.rs
+++ b/alacritty/src/config/bindings.rs
@@ -844,7 +845,7 @@ impl<'a> Deserialize<'a> for MouseButtonWrapper {
{
struct MouseButtonVisitor;
- impl<'a> Visitor<'a> for MouseButtonVisitor {
+ impl Visitor<'_> for MouseButtonVisitor {
type Value = MouseButtonWrapper;
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs
--- a/alacritty/src/config/bindings.rs
+++ b/alacritty/src/config/bindings.rs
@@ -956,7 +957,7 @@ impl<'a> Deserialize<'a> for RawBinding {
{
struct FieldVisitor;
- impl<'a> Visitor<'a> for FieldVisitor {
+ impl Visitor<'_> for FieldVisitor {
type Value = Field;
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs
--- a/alacritty/src/config/bindings.rs
+++ b/alacritty/src/config/bindings.rs
@@ -1204,7 +1205,7 @@ impl<'a> de::Deserialize<'a> for ModsWrapper {
{
struct ModsVisitor;
- impl<'a> Visitor<'a> for ModsVisitor {
+ impl Visitor<'_> for ModsVisitor {
type Value = ModsWrapper;
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
diff --git a/alacritty/src/config/font.rs b/alacritty/src/config/font.rs
--- a/alacritty/src/config/font.rs
+++ b/alacritty/src/config/font.rs
@@ -144,7 +144,7 @@ impl<'de> Deserialize<'de> for Size {
D: Deserializer<'de>,
{
struct NumVisitor;
- impl<'v> Visitor<'v> for NumVisitor {
+ impl Visitor<'_> for NumVisitor {
type Value = Size;
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs
--- a/alacritty/src/config/ui_config.rs
+++ b/alacritty/src/config/ui_config.rs
@@ -253,7 +253,7 @@ pub struct Hints {
alphabet: HintsAlphabet,
/// All configured terminal hints.
- pub enabled: Vec<Hint>,
+ pub enabled: Vec<Rc<Hint>>,
}
impl Default for Hints {
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs
--- a/alacritty/src/config/ui_config.rs
+++ b/alacritty/src/config/ui_config.rs
@@ -274,7 +274,7 @@ impl Default for Hints {
});
Self {
- enabled: vec![Hint {
+ enabled: vec![Rc::new(Hint {
content,
action,
persist: false,
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs
--- a/alacritty/src/config/ui_config.rs
+++ b/alacritty/src/config/ui_config.rs
@@ -288,7 +288,7 @@ impl Default for Hints {
mods: ModsWrapper(ModifiersState::SHIFT | ModifiersState::CONTROL),
mode: Default::default(),
}),
- }],
+ })],
alphabet: Default::default(),
}
}
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs
--- a/alacritty/src/config/ui_config.rs
+++ b/alacritty/src/config/ui_config.rs
@@ -619,7 +619,7 @@ impl SerdeReplace for Program {
}
pub(crate) struct StringVisitor;
-impl<'de> serde::de::Visitor<'de> for StringVisitor {
+impl serde::de::Visitor<'_> for StringVisitor {
type Value = String;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
diff --git a/alacritty/src/display/color.rs b/alacritty/src/display/color.rs
--- a/alacritty/src/display/color.rs
+++ b/alacritty/src/display/color.rs
@@ -18,7 +18,7 @@ pub const DIM_FACTOR: f32 = 0.66;
#[derive(Copy, Clone)]
pub struct List([Rgb; COUNT]);
-impl<'a> From<&'a Colors> for List {
+impl From<&'_ Colors> for List {
fn from(colors: &Colors) -> List {
// Type inference fails without this annotation.
let mut list = List([Rgb::default(); COUNT]);
diff --git a/alacritty/src/display/color.rs b/alacritty/src/display/color.rs
--- a/alacritty/src/display/color.rs
+++ b/alacritty/src/display/color.rs
@@ -235,7 +235,7 @@ impl<'de> Deserialize<'de> for Rgb {
b: u8,
}
- impl<'a> Visitor<'a> for RgbVisitor {
+ impl Visitor<'_> for RgbVisitor {
type Value = Rgb;
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
diff --git a/alacritty/src/display/color.rs b/alacritty/src/display/color.rs
--- a/alacritty/src/display/color.rs
+++ b/alacritty/src/display/color.rs
@@ -331,7 +331,7 @@ impl<'de> Deserialize<'de> for CellRgb {
const EXPECTING: &str = "CellForeground, CellBackground, or hex color like #ff00ff";
struct CellRgbVisitor;
- impl<'a> Visitor<'a> for CellRgbVisitor {
+ impl Visitor<'_> for CellRgbVisitor {
type Value = CellRgb;
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
diff --git a/alacritty/src/display/content.rs b/alacritty/src/display/content.rs
--- a/alacritty/src/display/content.rs
+++ b/alacritty/src/display/content.rs
@@ -150,7 +150,7 @@ impl<'a> RenderableContent<'a> {
}
}
-impl<'a> Iterator for RenderableContent<'a> {
+impl Iterator for RenderableContent<'_> {
type Item = RenderableCell;
/// Gets the next renderable cell.
diff --git a/alacritty/src/display/content.rs b/alacritty/src/display/content.rs
--- a/alacritty/src/display/content.rs
+++ b/alacritty/src/display/content.rs
@@ -453,7 +453,7 @@ struct Hint<'a> {
labels: &'a Vec<Vec<char>>,
}
-impl<'a> Hint<'a> {
+impl Hint<'_> {
/// Advance the hint iterator.
///
/// If the point is within a hint, the keyboard shortcut character that should be displayed at
diff --git a/alacritty/src/display/content.rs b/alacritty/src/display/content.rs
--- a/alacritty/src/display/content.rs
+++ b/alacritty/src/display/content.rs
@@ -543,7 +543,7 @@ impl<'a> HintMatches<'a> {
}
}
-impl<'a> Deref for HintMatches<'a> {
+impl Deref for HintMatches<'_> {
type Target = [Match];
fn deref(&self) -> &Self::Target {
diff --git a/alacritty/src/display/damage.rs b/alacritty/src/display/damage.rs
--- a/alacritty/src/display/damage.rs
+++ b/alacritty/src/display/damage.rs
@@ -193,9 +193,11 @@ impl FrameDamage {
/// Check if a range is damaged.
#[inline]
pub fn intersects(&self, start: Point<usize>, end: Point<usize>) -> bool {
+ let start_line = &self.lines[start.line];
+ let end_line = &self.lines[end.line];
self.full
- || self.lines[start.line].left <= start.column
- || self.lines[end.line].right >= end.column
+ || (start_line.left..=start_line.right).contains(&start.column)
+ || (end_line.left..=end_line.right).contains(&end.column)
|| (start.line + 1..end.line).any(|line| self.lines[line].is_damaged())
}
}
diff --git a/alacritty/src/display/damage.rs b/alacritty/src/display/damage.rs
--- a/alacritty/src/display/damage.rs
+++ b/alacritty/src/display/damage.rs
@@ -249,7 +251,7 @@ impl<'a> RenderDamageIterator<'a> {
}
}
-impl<'a> Iterator for RenderDamageIterator<'a> {
+impl Iterator for RenderDamageIterator<'_> {
type Item = Rect;
fn next(&mut self) -> Option<Rect> {
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -1,6 +1,8 @@
+use std::borrow::Cow;
use std::cmp::Reverse;
use std::collections::HashSet;
use std::iter;
+use std::rc::Rc;
use ahash::RandomState;
use winit::keyboard::ModifiersState;
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -23,7 +25,7 @@ const HINT_SPLIT_PERCENTAGE: f32 = 0.5;
/// Keyboard regex hint state.
pub struct HintState {
/// Hint currently in use.
- hint: Option<Hint>,
+ hint: Option<Rc<Hint>>,
/// Alphabet for hint labels.
alphabet: String,
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -56,7 +58,7 @@ impl HintState {
}
/// Start the hint selection process.
- pub fn start(&mut self, hint: Hint) {
+ pub fn start(&mut self, hint: Rc<Hint>) {
self.hint = Some(hint);
}
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -150,7 +152,7 @@ impl HintState {
// Check if the selected label is fully matched.
if label.len() == 1 {
let bounds = self.matches[index].clone();
- let action = hint.action.clone();
+ let hint = hint.clone();
// Exit hint mode unless it requires explicit dismissal.
if hint.persist {
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -161,7 +163,7 @@ impl HintState {
// Hyperlinks take precedence over regex matches.
let hyperlink = term.grid()[*bounds.start()].hyperlink();
- Some(HintMatch { action, bounds, hyperlink })
+ Some(HintMatch { bounds, hyperlink, hint })
} else {
// Store character to preserve the selection.
self.keys.push(c);
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -192,13 +194,14 @@ impl HintState {
/// Hint match which was selected by the user.
#[derive(PartialEq, Eq, Debug, Clone)]
pub struct HintMatch {
- /// Action for handling the text.
- action: HintAction,
-
/// Terminal range matching the hint.
bounds: Match,
+ /// OSC 8 hyperlink.
hyperlink: Option<Hyperlink>,
+
+ /// Hint which triggered this match.
+ hint: Rc<Hint>,
}
impl HintMatch {
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -210,7 +213,7 @@ impl HintMatch {
#[inline]
pub fn action(&self) -> &HintAction {
- &self.action
+ &self.hint.action
}
#[inline]
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -221,6 +224,29 @@ impl HintMatch {
pub fn hyperlink(&self) -> Option<&Hyperlink> {
self.hyperlink.as_ref()
}
+
+ /// Get the text content of the hint match.
+ ///
+ /// This will always revalidate the hint text, to account for terminal content
+ /// changes since the [`HintMatch`] was constructed. The text of the hint might
+ /// be different from its original value, but it will **always** be a valid
+ /// match for this hint.
+ pub fn text<T>(&self, term: &Term<T>) -> Option<Cow<'_, str>> {
+ // Revalidate hyperlink match.
+ if let Some(hyperlink) = &self.hyperlink {
+ let (validated, bounds) = hyperlink_at(term, *self.bounds.start())?;
+ return (&validated == hyperlink && bounds == self.bounds)
+ .then(|| hyperlink.uri().into());
+ }
+
+ // Revalidate regex match.
+ let regex = self.hint.content.regex.as_ref()?;
+ let bounds = regex.with_compiled(|regex| {
+ regex_match_at(term, *self.bounds.start(), regex, self.hint.post_processing)
+ })??;
+ (bounds == self.bounds)
+ .then(|| term.bounds_to_string(*bounds.start(), *bounds.end()).into())
+ }
}
/// Generator for creating new hint labels.
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -382,18 +408,14 @@ pub fn highlighted_at<T>(
if let Some((hyperlink, bounds)) =
hint.content.hyperlinks.then(|| hyperlink_at(term, point)).flatten()
{
- return Some(HintMatch {
- bounds,
- action: hint.action.clone(),
- hyperlink: Some(hyperlink),
- });
+ return Some(HintMatch { bounds, hyperlink: Some(hyperlink), hint: hint.clone() });
}
let bounds = hint.content.regex.as_ref().and_then(|regex| {
regex.with_compiled(|regex| regex_match_at(term, point, regex, hint.post_processing))
});
if let Some(bounds) = bounds.flatten() {
- return Some(HintMatch { bounds, action: hint.action.clone(), hyperlink: None });
+ return Some(HintMatch { bounds, hint: hint.clone(), hyperlink: None });
}
None
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -554,7 +576,7 @@ impl<'a, T> HintPostProcessor<'a, T> {
}
}
-impl<'a, T> Iterator for HintPostProcessor<'a, T> {
+impl<T> Iterator for HintPostProcessor<'_, T> {
type Item = Match;
fn next(&mut self) -> Option<Self::Item> {
diff --git a/alacritty/src/display/meter.rs b/alacritty/src/display/meter.rs
--- a/alacritty/src/display/meter.rs
+++ b/alacritty/src/display/meter.rs
@@ -57,7 +57,7 @@ impl<'a> Sampler<'a> {
}
}
-impl<'a> Drop for Sampler<'a> {
+impl Drop for Sampler<'_> {
fn drop(&mut self) {
self.meter.add_sample(self.alive_duration());
}
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -342,9 +342,13 @@ pub struct Display {
/// Hint highlighted by the mouse.
pub highlighted_hint: Option<HintMatch>,
+ /// Frames since hint highlight was created.
+ highlighted_hint_age: usize,
/// Hint highlighted by the vi mode cursor.
pub vi_highlighted_hint: Option<HintMatch>,
+ /// Frames since hint highlight was created.
+ vi_highlighted_hint_age: usize,
pub raw_window_handle: RawWindowHandle,
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -516,6 +520,8 @@ impl Display {
font_size,
window,
pending_renderer_update: Default::default(),
+ vi_highlighted_hint_age: Default::default(),
+ highlighted_hint_age: Default::default(),
vi_highlighted_hint: Default::default(),
highlighted_hint: Default::default(),
hint_mouse_point: Default::default(),
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -759,7 +765,7 @@ impl Display {
drop(terminal);
// Invalidate highlighted hints if grid has changed.
- self.validate_hints(display_offset);
+ self.validate_hint_highlights(display_offset);
// Add damage from alacritty's UI elements overlapping terminal.
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -1017,9 +1023,10 @@ impl Display {
};
let mut dirty = vi_highlighted_hint != self.vi_highlighted_hint;
self.vi_highlighted_hint = vi_highlighted_hint;
+ self.vi_highlighted_hint_age = 0;
// Force full redraw if the vi mode highlight was cleared.
- if dirty && self.vi_highlighted_hint.is_none() {
+ if dirty {
self.damage_tracker.frame().mark_fully_damaged();
}
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -1055,9 +1062,10 @@ impl Display {
let mouse_highlight_dirty = self.highlighted_hint != highlighted_hint;
dirty |= mouse_highlight_dirty;
self.highlighted_hint = highlighted_hint;
+ self.highlighted_hint_age = 0;
- // Force full redraw if the mouse cursor highlight was cleared.
- if mouse_highlight_dirty && self.highlighted_hint.is_none() {
+ // Force full redraw if the mouse cursor highlight was changed.
+ if mouse_highlight_dirty {
self.damage_tracker.frame().mark_fully_damaged();
}
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -1331,16 +1339,24 @@ impl Display {
}
/// Check whether a hint highlight needs to be cleared.
- fn validate_hints(&mut self, display_offset: usize) {
+ fn validate_hint_highlights(&mut self, display_offset: usize) {
let frame = self.damage_tracker.frame();
- for (hint, reset_mouse) in
- [(&mut self.highlighted_hint, true), (&mut self.vi_highlighted_hint, false)]
- {
+ let hints = [
+ (&mut self.highlighted_hint, &mut self.highlighted_hint_age, true),
+ (&mut self.vi_highlighted_hint, &mut self.vi_highlighted_hint_age, false),
+ ];
+ for (hint, hint_age, reset_mouse) in hints {
let (start, end) = match hint {
Some(hint) => (*hint.bounds().start(), *hint.bounds().end()),
- None => return,
+ None => continue,
};
+ // Ignore hints that were created this frame.
+ *hint_age += 1;
+ if *hint_age == 1 {
+ continue;
+ }
+
// Convert hint bounds to viewport coordinates.
let start = term::point_to_viewport(display_offset, start).unwrap_or_default();
let end = term::point_to_viewport(display_offset, end).unwrap_or_else(|| {
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -140,14 +140,14 @@ impl Processor {
pub fn create_initial_window(
&mut self,
event_loop: &ActiveEventLoop,
+ window_options: WindowOptions,
) -> Result<(), Box<dyn Error>> {
- let options = match self.initial_window_options.take() {
- Some(options) => options,
- None => return Ok(()),
- };
-
- let window_context =
- WindowContext::initial(event_loop, self.proxy.clone(), self.config.clone(), options)?;
+ let window_context = WindowContext::initial(
+ event_loop,
+ self.proxy.clone(),
+ self.config.clone(),
+ window_options,
+ )?;
self.gl_config = Some(window_context.display.gl_context().config());
self.windows.insert(window_context.id(), window_context);
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -225,10 +225,12 @@ impl ApplicationHandler<Event> for Processor {
return;
}
- if let Err(err) = self.create_initial_window(event_loop) {
- self.initial_window_error = Some(err);
- event_loop.exit();
- return;
+ if let Some(window_options) = self.initial_window_options.take() {
+ if let Err(err) = self.create_initial_window(event_loop, window_options) {
+ self.initial_window_error = Some(err);
+ event_loop.exit();
+ return;
+ }
}
info!("Initialisation complete");
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -276,7 +278,7 @@ impl ApplicationHandler<Event> for Processor {
}
// Handle events which don't mandate the WindowId.
- match (&event.payload, event.window_id.as_ref()) {
+ match (event.payload, event.window_id.as_ref()) {
// Process IPC config update.
#[cfg(unix)]
(EventType::IpcConfig(ipc_config), window_id) => {
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -315,7 +317,7 @@ impl ApplicationHandler<Event> for Processor {
}
// Load config and update each terminal.
- if let Ok(config) = config::reload(path, &mut self.cli_options) {
+ if let Ok(config) = config::reload(&path, &mut self.cli_options) {
self.config = Rc::new(config);
// Restart config monitor if imports changed.
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -346,17 +348,17 @@ impl ApplicationHandler<Event> for Processor {
if self.gl_config.is_none() {
// Handle initial window creation in daemon mode.
- if let Err(err) = self.create_initial_window(event_loop) {
+ if let Err(err) = self.create_initial_window(event_loop, options) {
self.initial_window_error = Some(err);
event_loop.exit();
}
- } else if let Err(err) = self.create_window(event_loop, options.clone()) {
+ } else if let Err(err) = self.create_window(event_loop, options) {
error!("Could not open window: {:?}", err);
}
},
// Process events affecting all windows.
- (_, None) => {
- let event = WinitEvent::UserEvent(event);
+ (payload, None) => {
+ let event = WinitEvent::UserEvent(Event::new(payload, None));
for window_context in self.windows.values_mut() {
window_context.handle_event(
#[cfg(target_os = "macos")]
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -405,7 +407,7 @@ impl ApplicationHandler<Event> for Processor {
}
}
},
- (_, Some(window_id)) => {
+ (payload, Some(window_id)) => {
if let Some(window_context) = self.windows.get_mut(window_id) {
window_context.handle_event(
#[cfg(target_os = "macos")]
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -413,7 +415,7 @@ impl ApplicationHandler<Event> for Processor {
&self.proxy,
&mut self.clipboard,
&mut self.scheduler,
- WinitEvent::UserEvent(event),
+ WinitEvent::UserEvent(Event::new(payload, *window_id)),
);
}
},
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -1141,16 +1143,16 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
}
let hint_bounds = hint.bounds();
- let text = match hint.hyperlink() {
- Some(hyperlink) => hyperlink.uri().to_owned(),
- None => self.terminal.bounds_to_string(*hint_bounds.start(), *hint_bounds.end()),
+ let text = match hint.text(self.terminal) {
+ Some(text) => text,
+ None => return,
};
match &hint.action() {
// Launch an external program.
HintAction::Command(command) => {
let mut args = command.args().to_vec();
- args.push(text);
+ args.push(text.into());
self.spawn_daemon(command.program(), &args);
},
// Copy the text to the clipboard.
diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs
--- a/alacritty/src/input/keyboard.rs
+++ b/alacritty/src/input/keyboard.rs
@@ -280,7 +280,7 @@ fn build_sequence(key: KeyEvent, mods: ModifiersState, mode: TermMode) -> Vec<u8
let sequence_base = context
.try_build_numpad(&key)
.or_else(|| context.try_build_named_kitty(&key))
- .or_else(|| context.try_build_named_normal(&key))
+ .or_else(|| context.try_build_named_normal(&key, associated_text.is_some()))
.or_else(|| context.try_build_control_char_or_mod(&key, &mut modifiers))
.or_else(|| context.try_build_textual(&key, associated_text));
diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs
--- a/alacritty/src/input/keyboard.rs
+++ b/alacritty/src/input/keyboard.rs
@@ -483,14 +483,23 @@ impl SequenceBuilder {
}
/// Try building from [`NamedKey`].
- fn try_build_named_normal(&self, key: &KeyEvent) -> Option<SequenceBase> {
+ fn try_build_named_normal(
+ &self,
+ key: &KeyEvent,
+ has_associated_text: bool,
+ ) -> Option<SequenceBase> {
let named = match key.logical_key {
Key::Named(named) => named,
_ => return None,
};
// The default parameter is 1, so we can omit it.
- let one_based = if self.modifiers.is_empty() && !self.kitty_event_type { "" } else { "1" };
+ let one_based =
+ if self.modifiers.is_empty() && !self.kitty_event_type && !has_associated_text {
+ ""
+ } else {
+ "1"
+ };
let (base, terminator) = match named {
NamedKey::PageUp => ("5", SequenceTerminator::Normal('~')),
NamedKey::PageDown => ("6", SequenceTerminator::Normal('~')),
diff --git a/alacritty/src/migrate/mod.rs b/alacritty/src/migrate/mod.rs
--- a/alacritty/src/migrate/mod.rs
+++ b/alacritty/src/migrate/mod.rs
@@ -151,7 +151,15 @@ fn migrate_imports(
// Migrate each import.
for import in imports.into_iter().filter_map(|item| item.as_str()) {
let normalized_path = config::normalize_import(path, import);
- let migration = migrate_config(options, &normalized_path, recursion_limit)?;
+
+ if !normalized_path.exists() {
+ if options.dry_run {
+ println!("Skipping migration for nonexistent path: {}", normalized_path.display());
+ }
+ continue;
+ }
+
+ let migration = migrate_config(options, &normalized_path, recursion_limit - 1)?;
if options.dry_run {
println!("{}", migration.success_message(true));
}
diff --git a/alacritty/src/migrate/mod.rs b/alacritty/src/migrate/mod.rs
--- a/alacritty/src/migrate/mod.rs
+++ b/alacritty/src/migrate/mod.rs
@@ -244,7 +252,7 @@ enum Migration<'a> {
Yaml((&'a Path, String)),
}
-impl<'a> Migration<'a> {
+impl Migration<'_> {
/// Get the success message for this migration.
fn success_message(&self, import: bool) -> String {
match self {
diff --git a/alacritty/src/renderer/text/gles2.rs b/alacritty/src/renderer/text/gles2.rs
--- a/alacritty/src/renderer/text/gles2.rs
+++ b/alacritty/src/renderer/text/gles2.rs
@@ -346,7 +346,7 @@ pub struct RenderApi<'a> {
dual_source_blending: bool,
}
-impl<'a> Drop for RenderApi<'a> {
+impl Drop for RenderApi<'_> {
fn drop(&mut self) {
if !self.batch.is_empty() {
self.render_batch();
diff --git a/alacritty/src/renderer/text/gles2.rs b/alacritty/src/renderer/text/gles2.rs
--- a/alacritty/src/renderer/text/gles2.rs
+++ b/alacritty/src/renderer/text/gles2.rs
@@ -354,7 +354,7 @@ impl<'a> Drop for RenderApi<'a> {
}
}
-impl<'a> LoadGlyph for RenderApi<'a> {
+impl LoadGlyph for RenderApi<'_> {
fn load_glyph(&mut self, rasterized: &RasterizedGlyph) -> Glyph {
Atlas::load_glyph(self.active_tex, self.atlas, self.current_atlas, rasterized)
}
diff --git a/alacritty/src/renderer/text/gles2.rs b/alacritty/src/renderer/text/gles2.rs
--- a/alacritty/src/renderer/text/gles2.rs
+++ b/alacritty/src/renderer/text/gles2.rs
@@ -364,7 +364,7 @@ impl<'a> LoadGlyph for RenderApi<'a> {
}
}
-impl<'a> TextRenderApi<Batch> for RenderApi<'a> {
+impl TextRenderApi<Batch> for RenderApi<'_> {
fn batch(&mut self) -> &mut Batch {
self.batch
}
diff --git a/alacritty/src/renderer/text/glsl3.rs b/alacritty/src/renderer/text/glsl3.rs
--- a/alacritty/src/renderer/text/glsl3.rs
+++ b/alacritty/src/renderer/text/glsl3.rs
@@ -215,7 +215,7 @@ pub struct RenderApi<'a> {
program: &'a mut TextShaderProgram,
}
-impl<'a> TextRenderApi<Batch> for RenderApi<'a> {
+impl TextRenderApi<Batch> for RenderApi<'_> {
fn batch(&mut self) -> &mut Batch {
self.batch
}
diff --git a/alacritty/src/renderer/text/glsl3.rs b/alacritty/src/renderer/text/glsl3.rs
--- a/alacritty/src/renderer/text/glsl3.rs
+++ b/alacritty/src/renderer/text/glsl3.rs
@@ -261,7 +261,7 @@ impl<'a> TextRenderApi<Batch> for RenderApi<'a> {
}
}
-impl<'a> LoadGlyph for RenderApi<'a> {
+impl LoadGlyph for RenderApi<'_> {
fn load_glyph(&mut self, rasterized: &RasterizedGlyph) -> Glyph {
Atlas::load_glyph(self.active_tex, self.atlas, self.current_atlas, rasterized)
}
diff --git a/alacritty/src/renderer/text/glsl3.rs b/alacritty/src/renderer/text/glsl3.rs
--- a/alacritty/src/renderer/text/glsl3.rs
+++ b/alacritty/src/renderer/text/glsl3.rs
@@ -271,7 +271,7 @@ impl<'a> LoadGlyph for RenderApi<'a> {
}
}
-impl<'a> Drop for RenderApi<'a> {
+impl Drop for RenderApi<'_> {
fn drop(&mut self) {
if !self.batch.is_empty() {
self.render_batch();
diff --git a/alacritty/src/renderer/text/mod.rs b/alacritty/src/renderer/text/mod.rs
--- a/alacritty/src/renderer/text/mod.rs
+++ b/alacritty/src/renderer/text/mod.rs
@@ -186,7 +186,7 @@ pub struct LoaderApi<'a> {
current_atlas: &'a mut usize,
}
-impl<'a> LoadGlyph for LoaderApi<'a> {
+impl LoadGlyph for LoaderApi<'_> {
fn load_glyph(&mut self, rasterized: &RasterizedGlyph) -> Glyph {
Atlas::load_glyph(self.active_tex, self.atlas, self.current_atlas, rasterized)
}
diff --git a/alacritty/src/string.rs b/alacritty/src/string.rs
--- a/alacritty/src/string.rs
+++ b/alacritty/src/string.rs
@@ -106,7 +106,7 @@ impl<'a> StrShortener<'a> {
}
}
-impl<'a> Iterator for StrShortener<'a> {
+impl Iterator for StrShortener<'_> {
type Item = char;
fn next(&mut self) -> Option<Self::Item> {
diff --git a/alacritty/windows/wix/alacritty.wxs b/alacritty/windows/wix/alacritty.wxs
--- a/alacritty/windows/wix/alacritty.wxs
+++ b/alacritty/windows/wix/alacritty.wxs
@@ -1,5 +1,5 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
- <Package Name="Alacritty" UpgradeCode="87c21c74-dbd5-4584-89d5-46d9cd0c40a7" Language="1033" Codepage="1252" Version="0.14.0" Manufacturer="Alacritty" InstallerVersion="200">
+ <Package Name="Alacritty" UpgradeCode="87c21c74-dbd5-4584-89d5-46d9cd0c40a7" Language="1033" Codepage="1252" Version="0.14.1-rc1" Manufacturer="Alacritty" InstallerVersion="200">
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Icon Id="AlacrittyIco" SourceFile=".\alacritty\windows\alacritty.ico" />
<WixVariable Id="WixUILicenseRtf" Value=".\alacritty\windows\wix\license.rtf" />
diff --git a/alacritty_terminal/CHANGELOG.md b/alacritty_terminal/CHANGELOG.md
--- a/alacritty_terminal/CHANGELOG.md
+++ b/alacritty_terminal/CHANGELOG.md
@@ -8,6 +8,12 @@ sections should follow the order `Added`, `Changed`, `Deprecated`, `Fixed` and
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+## 0.24.2
+
+### Fixed
+
+- Semantic escape search across wide characters
+
## 0.24.1
### Changed
diff --git a/alacritty_terminal/Cargo.toml b/alacritty_terminal/Cargo.toml
--- a/alacritty_terminal/Cargo.toml
+++ b/alacritty_terminal/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "alacritty_terminal"
-version = "0.24.1"
+version = "0.24.2-rc1"
authors = ["Christian Duerr <contact@christianduerr.com>", "Joe Wilm <joe@jwilm.com>"]
license = "Apache-2.0"
description = "Library for writing terminal emulators"
diff --git a/alacritty_terminal/src/grid/mod.rs b/alacritty_terminal/src/grid/mod.rs
--- a/alacritty_terminal/src/grid/mod.rs
+++ b/alacritty_terminal/src/grid/mod.rs
@@ -615,7 +615,7 @@ pub trait BidirectionalIterator: Iterator {
fn prev(&mut self) -> Option<Self::Item>;
}
-impl<'a, T> BidirectionalIterator for GridIterator<'a, T> {
+impl<T> BidirectionalIterator for GridIterator<'_, T> {
fn prev(&mut self) -> Option<Self::Item> {
let topmost_line = self.grid.topmost_line();
let last_column = self.grid.last_column();
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -199,7 +199,7 @@ impl<'a> TermDamageIterator<'a> {
}
}
-impl<'a> Iterator for TermDamageIterator<'a> {
+impl Iterator for TermDamageIterator<'_> {
type Item = LineDamageBounds;
fn next(&mut self) -> Option<Self::Item> {
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -656,7 +656,7 @@ impl<'a, T> RegexIter<'a, T> {
}
}
-impl<'a, T> Iterator for RegexIter<'a, T> {
+impl<T> Iterator for RegexIter<'_, T> {
type Item = Match;
fn next(&mut self) -> Option<Self::Item> {
diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs
--- a/alacritty_terminal/src/vi_mode.rs
+++ b/alacritty_terminal/src/vi_mode.rs
@@ -265,14 +265,14 @@ fn semantic<T: EventListener>(
}
};
- // Make sure we jump above wide chars.
- point = term.expand_wide(point, direction);
-
// Move to word boundary.
if direction != side && !is_boundary(term, point, direction) {
point = expand_semantic(point);
}
+ // Make sure we jump above wide chars.
+ point = term.expand_wide(point, direction);
+
// Skip whitespace.
let mut next_point = advance(term, point, direction);
while !is_boundary(term, point, direction) && is_space(term, next_point) {
diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs
--- a/alacritty_terminal/src/vi_mode.rs
+++ b/alacritty_terminal/src/vi_mode.rs
@@ -283,6 +283,11 @@ fn semantic<T: EventListener>(
// Assure minimum movement of one cell.
if !is_boundary(term, point, direction) {
point = advance(term, point, direction);
+
+ // Skip over wide cell spacers.
+ if direction == Direction::Left {
+ point = term.expand_wide(point, direction);
+ }
}
// Move to word boundary.
diff --git a/extra/osx/Alacritty.app/Contents/Info.plist b/extra/osx/Alacritty.app/Contents/Info.plist
--- a/extra/osx/Alacritty.app/Contents/Info.plist
+++ b/extra/osx/Alacritty.app/Contents/Info.plist
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>0.14.0</string>
+ <string>0.14.1-rc1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
| diff --git a/alacritty/src/input/mod.rs b/alacritty/src/input/mod.rs
--- a/alacritty/src/input/mod.rs
+++ b/alacritty/src/input/mod.rs
@@ -1136,7 +1136,7 @@ mod tests {
inline_search_state: &'a mut InlineSearchState,
}
- impl<'a, T: EventListener> super::ActionContext<T> for ActionContext<'a, T> {
+ impl<T: EventListener> super::ActionContext<T> for ActionContext<'_, T> {
fn search_next(
&mut self,
_origin: Point,
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -930,6 +930,11 @@ impl<T> Term<T> {
&self.config.semantic_escape_chars
}
+ #[cfg(test)]
+ pub(crate) fn set_semantic_escape_chars(&mut self, semantic_escape_chars: &str) {
+ self.config.semantic_escape_chars = semantic_escape_chars.into();
+ }
+
/// Active terminal cursor style.
///
/// While vi mode is active, this will automatically return the vi mode cursor style.
diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs
--- a/alacritty_terminal/src/vi_mode.rs
+++ b/alacritty_terminal/src/vi_mode.rs
@@ -820,4 +825,42 @@ mod tests {
cursor = cursor.scroll(&term, -20);
assert_eq!(cursor.point, Point::new(Line(19), Column(0)));
}
+
+ #[test]
+ fn wide_semantic_char() {
+ let mut term = term();
+ term.set_semantic_escape_chars("-");
+ term.grid_mut()[Line(0)][Column(0)].c = 'x';
+ term.grid_mut()[Line(0)][Column(1)].c = 'x';
+ term.grid_mut()[Line(0)][Column(2)].c = '-';
+ term.grid_mut()[Line(0)][Column(2)].flags.insert(Flags::WIDE_CHAR);
+ term.grid_mut()[Line(0)][Column(3)].c = ' ';
+ term.grid_mut()[Line(0)][Column(3)].flags.insert(Flags::WIDE_CHAR_SPACER);
+ term.grid_mut()[Line(0)][Column(4)].c = 'x';
+ term.grid_mut()[Line(0)][Column(5)].c = 'x';
+
+ // Test motion to the right.
+
+ let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(0)));
+ cursor = cursor.motion(&mut term, ViMotion::SemanticRight);
+ assert_eq!(cursor.point, Point::new(Line(0), Column(2)));
+
+ let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(2)));
+ cursor = cursor.motion(&mut term, ViMotion::SemanticRight);
+ assert_eq!(cursor.point, Point::new(Line(0), Column(4)));
+
+ // Test motion to the left.
+
+ let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(5)));
+ cursor = cursor.motion(&mut term, ViMotion::SemanticLeft);
+ assert_eq!(cursor.point, Point::new(Line(0), Column(4)));
+
+ let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(4)));
+ cursor = cursor.motion(&mut term, ViMotion::SemanticLeft);
+ assert_eq!(cursor.point, Point::new(Line(0), Column(2)));
+
+ let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(2)));
+ cursor = cursor.motion(&mut term, ViMotion::SemanticLeft);
+ assert_eq!(cursor.point, Point::new(Line(0), Column(0)));
+ }
}
| Semantic characters in Vi Mode and moving left
### System
OS: Linux 6.11.9 (arch)
Version: alacritty 0.14.0 (22a44757)
Sway 1:1.10-1
```
[0.000000942s] [INFO ] [alacritty] Welcome to Alacritty
[0.000051958s] [INFO ] [alacritty] Version 0.14.0 (22a44757)
[0.000061095s] [INFO ] [alacritty] Running on Wayland
[0.000525696s] [INFO ] [alacritty] Configuration files loaded from:
".config/alacritty/alacritty.toml"
".config/alacritty/themes/themes/tokyo-night.toml"
[0.032020983s] [INFO ] [alacritty] Using EGL 1.5
[0.032067079s] [DEBUG] [alacritty] Picked GL Config:
buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 })
alpha_size: 8
num_samples: 0
hardware_accelerated: true
supports_transparency: Some(true)
config_api: Api(OPENGL | GLES1 | GLES2 | GLES3)
srgb_capable: true
[0.035075269s] [INFO ] [alacritty] Window scale factor: 1
[0.036997955s] [DEBUG] [alacritty] Loading "JetBrains Mono" font
[0.048522765s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: LoadFlag(FORCE_AUTOHINT | TARGET_LIGHT | TARGET_MONO), render_mode: "Lcd", lcd_filter: 1 }
[0.052494282s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Italic, load_flags: LoadFlag(FORCE_AUTOHINT | TARGET_LIGHT | TARGET_MONO), render_mode: "Lcd", lcd_filter: 1 }
[0.056145538s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold Italic, load_flags: LoadFlag(FORCE_AUTOHINT | TARGET_LIGHT | TARGET_MONO), render_mode: "Lcd", lcd_filter: 1 }
[0.061237837s] [INFO ] [alacritty] Running on AMD Radeon Graphics (radeonsi, renoir, LLVM 18.1.8, DRM 3.59, 6.11.9-zen1-1-zen)
[0.061260339s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 24.2.7-arch1.1, shader_version 4.60
[0.061267753s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[0.068799656s] [DEBUG] [alacritty] Enabled debug logging for OpenGL
[0.070534168s] [DEBUG] [alacritty] Filling glyph cache with common glyphs
[0.080691745s] [INFO ] [alacritty] Cell size: 10 x 25
[0.080720799s] [INFO ] [alacritty] Padding: 0 x 0
[0.080725207s] [INFO ] [alacritty] Width: 800, Height: 600
[0.080761626s] [INFO ] [alacritty] PTY dimensions: 24 x 80
[0.084459059s] [INFO ] [alacritty] Initialisation complete
[0.105657768s] [INFO ] [alacritty] Font size changed to 18.666666 px
[0.105695439s] [INFO ] [alacritty] Cell size: 10 x 25
[0.105708323s] [DEBUG] [alacritty_terminal] New num_cols is 191 and num_lines is 40
[0.110029896s] [INFO ] [alacritty] Padding: 0 x 0
[0.110058470s] [INFO ] [alacritty] Width: 1916, Height: 1020
```
When in Vi Mode [Shift]+[Ctrl]+[Space], moving to the left with [B] "SemanticLeft" does not work for all semantic characters:
`this is a test-STAHP.STAHP—yes this is a test-move test•lets go`
In the above, the characters to the left of "STAHP" causes the cursor to... stop. Moving forward with [E] is fine. The only way to move past those characters is to use the cursor keys.
Please be so kind as to look into this if you have the time at hand to spare.
With humble thanks.
macOS specific keyboard input crashes alacritty 0.14.0
edit: changed the topic title to better reflect the issue given what others have commented regarding their own experience with crashing.
I use a piece of software on macOS called [BetterTouchTool](https://folivora.ai/) and one of its features is being able to turn caps lock into a hyper key. Hyper key for the uninitiated is actually a simultaneous key press event for the actual modifier keys `Command|Shift|Control|Option`. I use the hyper key in combination with keyboard bindings within alacritty such that my hyper key essentially handles the standard bash / readline Ctrl-* key sequences--that is to say, Hyper-C acts as Ctrl-c and terminates a process.
```
[[keyboard.bindings]]
chars = "\u0003"
key = "C"
mods = "Command|Shift|Control|Option"
```
Previously, (i.e. the past two years) this was working just fine.
Expected behavior: The character sequence defined in the key binding is sent, the desired effect occurs, and the terminal continues to operate without issue.
Actual behavior: Repeated (although sometimes on the first try) use of the hyper key crashes the terminal causing it to suddenly close.
### System
OS:
```
> sw_vers
ProductName: macOS
ProductVersion: 15.0.1
BuildVersion: 24A348
```
Version:
```
> alacritty --version
alacritty 0.14.0 (22a4475)
```
### Logs
```
[2.758060875s] [INFO ] [alacritty_winit_event] Event { window_id: Some(WindowId(5198973488)), payload: Frame }
[2.758098667s] [INFO ] [alacritty_winit_event] About to wait
[2.758120958s] [INFO ] [alacritty_winit_event] About to wait
[2.765228375s] [INFO ] [alacritty_winit_event] About to wait
[2.771734167s] [INFO ] [alacritty_winit_event] ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) })
[2.771803708s] [INFO ] [alacritty_winit_event] KeyboardInput { device_id: DeviceId(DeviceId), event: KeyEvent { physical_key: Code(ControlLeft), logical_key: Named(Control), text: None, location: Left, state: Released, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifiers: None, key_without_modifiers: Named(Control) } }, is_synthetic: false }
[2.771818125s] [INFO ] [alacritty_winit_event] ModifiersChanged(Modifiers { state: ModifiersState(SHIFT | ALT | SUPER), pressed_mods: ModifiersKeys(0x0) })
[2.771874583s] [INFO ] [alacritty_winit_event] KeyboardInput { device_id: DeviceId(DeviceId), event: KeyEvent { physical_key: Code(ShiftLeft), logical_key: Named(Shift), text: None, location: Left, state: Released, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifiers: None, key_without_modifiers: Named(Shift) } }, is_synthetic: false }
[2.771896125s] [INFO ] [alacritty_winit_event] ModifiersChanged(Modifiers { state: ModifiersState(ALT | SUPER), pressed_mods: ModifiersKeys(0x0) })
[2.771950375s] [INFO ] [alacritty_winit_event] KeyboardInput { device_id: DeviceId(DeviceId), event: KeyEvent { physical_key: Code(AltLeft), logical_key: Named(Alt), text: None, location: Left, state: Released, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifiers: None, key_without_modifiers: Named(Alt) } }, is_synthetic: false }
[2.771962542s] [INFO ] [alacritty_winit_event] ModifiersChanged(Modifiers { state: ModifiersState(SUPER), pressed_mods: ModifiersKeys(0x0) })
[2.772015583s] [INFO ] [alacritty_winit_event] KeyboardInput { device_id: DeviceId(DeviceId), event: KeyEvent { physical_key: Code(SuperLeft), logical_key: Named(Super), text: None, location: Left, state: Released, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifiers: None, key_without_modifiers: Named(Super) } }, is_synthetic: false }
[2.772026875s] [INFO ] [alacritty_winit_event] ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) })
[2.772066917s] [INFO ] [alacritty_winit_event] About to wait
[2.772157250s] [INFO ] [alacritty_winit_event] About to wait
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid message sent to event "NSEvent: type=FlagsChanged loc=(0,744) time=3879.1 flags=0x100 win=0x135e20a30 winNum=1167 ctxt=0x0 keyCode=15"'
*** First throw call stack:
(
0 CoreFoundation 0x00000001955b0ec0 __exceptionPreprocess + 176
1 libobjc.A.dylib 0x0000000195096cd8 objc_exception_throw + 88
2 Foundation 0x00000001967ad588 -[NSCalendarDate initWithCoder:] + 0
3 AppKit 0x0000000199225cec -[NSEvent charactersIgnoringModifiers] + 604
4 alacritty 0x0000000104969154 _ZN5winit13platform_impl5macos5event16create_key_event17h5ffd7f45014bc6b9E + 2508
5 alacritty 0x00000001049594a8 _ZN5winit13platform_impl5macos4view9WinitView13flags_changed17h58c32ee31fdc0f1bE + 344
6 AppKit 0x00000001991a80a8 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 484
7 AppKit 0x00000001991a7cf4 -[NSWindow(NSEventRouting) sendEvent:] + 284
8 AppKit 0x00000001999a53e0 -[NSApplication(NSEventRouting) sendEvent:] + 1212
9 alacritty 0x0000000104961a3c _ZN5winit13platform_impl5macos3app16WinitApplication10send_event17h9d7b11ed09e187deE + 1040
10 AppKit 0x00000001995b8984 -[NSApplication _handleEvent:] + 60
11 AppKit 0x0000000199073ba4 -[NSApplication run] + 520
12 alacritty 0x000000010469e090 _ZN5winit13platform_impl5macos13event_handler12EventHandler3set17ha6185e593ba31ad4E + 280
13 alacritty 0x000000010474d378 _ZN9alacritty4main17h290211ac615fedbeE + 7624
14 alacritty 0x00000001046c2060 _ZN3std3sys9backtrace28__rust_begin_short_backtrace17h86645a6c57eec1ecE + 12
15 alacritty 0x000000010468392c _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h7b27810acbbe86f2E + 16
16 alacritty 0x00000001048f1598 _ZN3std2rt19lang_start_internal17h9e88109c8deb8787E + 808
17 alacritty 0x000000010474de4c main + 52
18 dyld 0x00000001950d4274 start + 2840
)
libc++abi: terminating due to uncaught exception of type NSException
[1] 14442 abort alacritty -vv --print-events
```
I cannot confirm if this hyper key issue applies to any other piece of software that adds this functionality (such as karabiner elements) or if this is an issue specific to how bettertouchtool implements hyperkey. For meanwhile, I've downgraded back to [alacritty 0.13.2](https://github.com/Homebrew/homebrew-cask/blob/ee57cb02e89536c4eb0624e7175705c947693ac7/Casks/a/alacritty.rb) which has resolved the issue.
```
curl 'https://raw.githubusercontent.com/Homebrew/homebrew-cask/ee57cb02e89536c4eb0624e7175705c947693ac7/Casks/a/alacritty.rb' -o alacritty.rb
brew install -s alacritty.rb
```
Not sure if there's something I'm overlooking with the latest update. Appreciate any help.
| 2024-12-14T09:10:33 | 0.14 | 22a447573bbd67c0a5d3946d58d6d61bac3b4ad2 | [
"vi_mode::tests::wide_semantic_char"
] | [
"grid::storage::tests::indexing",
"grid::storage::tests::rotate",
"grid::storage::tests::shrink_before_and_after_zero",
"grid::storage::tests::rotate_wrap_zero",
"grid::storage::tests::indexing_above_inner_len - should panic",
"grid::storage::tests::shrink_after_zero",
"grid::storage::tests::shrink_befo... | [] | [] | 1 | |
alacritty/alacritty | 8,315 | alacritty__alacritty-8315 | [
"8314"
] | 4f739a7e2b933f6828ebf64654c8a8c573bf0ec1 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its
- Mouse/Vi cursor hint highlighting broken on the terminal cursor line
- Hint launcher opening arbitrary text, when terminal content changed while opening
+- `SemanticRight`/`SemanticLeft` vi motions breaking with wide semantic escape characters
## 0.14.0
diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs
--- a/alacritty_terminal/src/vi_mode.rs
+++ b/alacritty_terminal/src/vi_mode.rs
@@ -265,14 +265,14 @@ fn semantic<T: EventListener>(
}
};
- // Make sure we jump above wide chars.
- point = term.expand_wide(point, direction);
-
// Move to word boundary.
if direction != side && !is_boundary(term, point, direction) {
point = expand_semantic(point);
}
+ // Make sure we jump above wide chars.
+ point = term.expand_wide(point, direction);
+
// Skip whitespace.
let mut next_point = advance(term, point, direction);
while !is_boundary(term, point, direction) && is_space(term, next_point) {
diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs
--- a/alacritty_terminal/src/vi_mode.rs
+++ b/alacritty_terminal/src/vi_mode.rs
@@ -283,6 +283,11 @@ fn semantic<T: EventListener>(
// Assure minimum movement of one cell.
if !is_boundary(term, point, direction) {
point = advance(term, point, direction);
+
+ // Skip over wide cell spacers.
+ if direction == Direction::Left {
+ point = term.expand_wide(point, direction);
+ }
}
// Move to word boundary.
| diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -930,6 +930,11 @@ impl<T> Term<T> {
&self.config.semantic_escape_chars
}
+ #[cfg(test)]
+ pub(crate) fn set_semantic_escape_chars(&mut self, semantic_escape_chars: &str) {
+ self.config.semantic_escape_chars = semantic_escape_chars.into();
+ }
+
/// Active terminal cursor style.
///
/// While vi mode is active, this will automatically return the vi mode cursor style.
diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs
--- a/alacritty_terminal/src/vi_mode.rs
+++ b/alacritty_terminal/src/vi_mode.rs
@@ -820,4 +825,42 @@ mod tests {
cursor = cursor.scroll(&term, -20);
assert_eq!(cursor.point, Point::new(Line(19), Column(0)));
}
+
+ #[test]
+ fn wide_semantic_char() {
+ let mut term = term();
+ term.set_semantic_escape_chars("-");
+ term.grid_mut()[Line(0)][Column(0)].c = 'x';
+ term.grid_mut()[Line(0)][Column(1)].c = 'x';
+ term.grid_mut()[Line(0)][Column(2)].c = '-';
+ term.grid_mut()[Line(0)][Column(2)].flags.insert(Flags::WIDE_CHAR);
+ term.grid_mut()[Line(0)][Column(3)].c = ' ';
+ term.grid_mut()[Line(0)][Column(3)].flags.insert(Flags::WIDE_CHAR_SPACER);
+ term.grid_mut()[Line(0)][Column(4)].c = 'x';
+ term.grid_mut()[Line(0)][Column(5)].c = 'x';
+
+ // Test motion to the right.
+
+ let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(0)));
+ cursor = cursor.motion(&mut term, ViMotion::SemanticRight);
+ assert_eq!(cursor.point, Point::new(Line(0), Column(2)));
+
+ let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(2)));
+ cursor = cursor.motion(&mut term, ViMotion::SemanticRight);
+ assert_eq!(cursor.point, Point::new(Line(0), Column(4)));
+
+ // Test motion to the left.
+
+ let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(5)));
+ cursor = cursor.motion(&mut term, ViMotion::SemanticLeft);
+ assert_eq!(cursor.point, Point::new(Line(0), Column(4)));
+
+ let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(4)));
+ cursor = cursor.motion(&mut term, ViMotion::SemanticLeft);
+ assert_eq!(cursor.point, Point::new(Line(0), Column(2)));
+
+ let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(2)));
+ cursor = cursor.motion(&mut term, ViMotion::SemanticLeft);
+ assert_eq!(cursor.point, Point::new(Line(0), Column(0)));
+ }
}
| Semantic characters in Vi Mode and moving left
### System
OS: Linux 6.11.9 (arch)
Version: alacritty 0.14.0 (22a44757)
Sway 1:1.10-1
```
[0.000000942s] [INFO ] [alacritty] Welcome to Alacritty
[0.000051958s] [INFO ] [alacritty] Version 0.14.0 (22a44757)
[0.000061095s] [INFO ] [alacritty] Running on Wayland
[0.000525696s] [INFO ] [alacritty] Configuration files loaded from:
".config/alacritty/alacritty.toml"
".config/alacritty/themes/themes/tokyo-night.toml"
[0.032020983s] [INFO ] [alacritty] Using EGL 1.5
[0.032067079s] [DEBUG] [alacritty] Picked GL Config:
buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 })
alpha_size: 8
num_samples: 0
hardware_accelerated: true
supports_transparency: Some(true)
config_api: Api(OPENGL | GLES1 | GLES2 | GLES3)
srgb_capable: true
[0.035075269s] [INFO ] [alacritty] Window scale factor: 1
[0.036997955s] [DEBUG] [alacritty] Loading "JetBrains Mono" font
[0.048522765s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: LoadFlag(FORCE_AUTOHINT | TARGET_LIGHT | TARGET_MONO), render_mode: "Lcd", lcd_filter: 1 }
[0.052494282s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Italic, load_flags: LoadFlag(FORCE_AUTOHINT | TARGET_LIGHT | TARGET_MONO), render_mode: "Lcd", lcd_filter: 1 }
[0.056145538s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold Italic, load_flags: LoadFlag(FORCE_AUTOHINT | TARGET_LIGHT | TARGET_MONO), render_mode: "Lcd", lcd_filter: 1 }
[0.061237837s] [INFO ] [alacritty] Running on AMD Radeon Graphics (radeonsi, renoir, LLVM 18.1.8, DRM 3.59, 6.11.9-zen1-1-zen)
[0.061260339s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 24.2.7-arch1.1, shader_version 4.60
[0.061267753s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[0.068799656s] [DEBUG] [alacritty] Enabled debug logging for OpenGL
[0.070534168s] [DEBUG] [alacritty] Filling glyph cache with common glyphs
[0.080691745s] [INFO ] [alacritty] Cell size: 10 x 25
[0.080720799s] [INFO ] [alacritty] Padding: 0 x 0
[0.080725207s] [INFO ] [alacritty] Width: 800, Height: 600
[0.080761626s] [INFO ] [alacritty] PTY dimensions: 24 x 80
[0.084459059s] [INFO ] [alacritty] Initialisation complete
[0.105657768s] [INFO ] [alacritty] Font size changed to 18.666666 px
[0.105695439s] [INFO ] [alacritty] Cell size: 10 x 25
[0.105708323s] [DEBUG] [alacritty_terminal] New num_cols is 191 and num_lines is 40
[0.110029896s] [INFO ] [alacritty] Padding: 0 x 0
[0.110058470s] [INFO ] [alacritty] Width: 1916, Height: 1020
```
When in Vi Mode [Shift]+[Ctrl]+[Space], moving to the left with [B] "SemanticLeft" does not work for all semantic characters:
`this is a test-STAHP.STAHP—yes this is a test-move test•lets go`
In the above, the characters to the left of "STAHP" causes the cursor to... stop. Moving forward with [E] is fine. The only way to move past those characters is to use the cursor keys.
Please be so kind as to look into this if you have the time at hand to spare.
With humble thanks.
| I'd assume that you have those wide chars in semantic chars specified, since wide chars are not there by default.
Yes.
`[selection]
semantic_escape_chars = ",│`|:\"' ()[]{}<>\t•-—-."
`
It seems like `b` isn't the only binding affected. The `w` binding also does not work correctly. | 2024-11-20T09:21:31 | 1.74 | 4f739a7e2b933f6828ebf64654c8a8c573bf0ec1 | [
"vi_mode::tests::wide_semantic_char"
] | [
"grid::storage::tests::indexing",
"grid::storage::tests::rotate",
"grid::storage::tests::indexing_above_inner_len - should panic",
"grid::storage::tests::rotate_wrap_zero",
"grid::storage::tests::shrink_after_zero",
"grid::storage::tests::shrink_before_and_after_zero",
"grid::storage::tests::shrink_befo... | [] | [] | 2 |
alacritty/alacritty | 8,069 | alacritty__alacritty-8069 | [
"8060"
] | 5e6b92db85b3ea7ffd06a7a5ae0d2d62ad5946a6 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,6 +31,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its
- Leaking FDs when closing windows on Unix systems
- Config emitting errors for nonexistent import paths
- Kitty keyboard protocol reporting shifted key codes
+- Broken search with words broken across line boundary on the first character
## 0.13.2
diff --git a/alacritty/src/renderer/text/glyph_cache.rs b/alacritty/src/renderer/text/glyph_cache.rs
--- a/alacritty/src/renderer/text/glyph_cache.rs
+++ b/alacritty/src/renderer/text/glyph_cache.rs
@@ -187,14 +187,9 @@ impl GlyphCache {
///
/// This will fail when the glyph could not be rasterized. Usually this is due to the glyph
/// not being present in any font.
- pub fn get<L: ?Sized>(
- &mut self,
- glyph_key: GlyphKey,
- loader: &mut L,
- show_missing: bool,
- ) -> Glyph
+ pub fn get<L>(&mut self, glyph_key: GlyphKey, loader: &mut L, show_missing: bool) -> Glyph
where
- L: LoadGlyph,
+ L: LoadGlyph + ?Sized,
{
// Try to load glyph from cache.
if let Some(glyph) = self.cache.get(&glyph_key) {
diff --git a/alacritty/src/renderer/text/glyph_cache.rs b/alacritty/src/renderer/text/glyph_cache.rs
--- a/alacritty/src/renderer/text/glyph_cache.rs
+++ b/alacritty/src/renderer/text/glyph_cache.rs
@@ -242,9 +237,9 @@ impl GlyphCache {
/// Load glyph into the atlas.
///
/// This will apply all transforms defined for the glyph cache to the rasterized glyph before
- pub fn load_glyph<L: ?Sized>(&self, loader: &mut L, mut glyph: RasterizedGlyph) -> Glyph
+ pub fn load_glyph<L>(&self, loader: &mut L, mut glyph: RasterizedGlyph) -> Glyph
where
- L: LoadGlyph,
+ L: LoadGlyph + ?Sized,
{
glyph.left += i32::from(self.glyph_offset.x);
glyph.top += i32::from(self.glyph_offset.y);
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -1445,15 +1445,15 @@ impl<T: EventListener> Handler for Term<T> {
/// edition, in LINE FEED mode,
///
/// > The execution of the formatter functions LINE FEED (LF), FORM FEED
- /// (FF), LINE TABULATION (VT) cause only movement of the active position in
- /// the direction of the line progression.
+ /// > (FF), LINE TABULATION (VT) cause only movement of the active position in
+ /// > the direction of the line progression.
///
/// In NEW LINE mode,
///
/// > The execution of the formatter functions LINE FEED (LF), FORM FEED
- /// (FF), LINE TABULATION (VT) cause movement to the line home position on
- /// the following line, the following form, etc. In the case of LF this is
- /// referred to as the New Line (NL) option.
+ /// > (FF), LINE TABULATION (VT) cause movement to the line home position on
+ /// > the following line, the following form, etc. In the case of LF this is
+ /// > referred to as the New Line (NL) option.
///
/// Additionally, ECMA-48 4th edition says that this option is deprecated.
/// ECMA-48 5th edition only mentions this option (without explanation)
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -2187,7 +2187,7 @@ impl<T: EventListener> Handler for Term<T> {
fn set_title(&mut self, title: Option<String>) {
trace!("Setting title to '{:?}'", title);
- self.title = title.clone();
+ self.title.clone_from(&title);
let title_event = match title {
Some(title) => Event::Title(title),
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -293,12 +293,12 @@ impl<T> Term<T> {
let mut state = regex.dfa.start_state_forward(&mut regex.cache, &input).unwrap();
let mut iter = self.grid.iter_from(start);
- let mut last_wrapped = false;
let mut regex_match = None;
let mut done = false;
let mut cell = iter.cell();
self.skip_fullwidth(&mut iter, &mut cell, regex.direction);
+ let mut last_wrapped = cell.flags.contains(Flags::WRAPLINE);
let mut c = cell.c;
let mut point = iter.point();
| diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -1155,4 +1155,20 @@ mod tests {
assert_eq!(start, Point::new(Line(1), Column(0)));
assert_eq!(end, Point::new(Line(1), Column(2)));
}
+
+ #[test]
+ fn inline_word_search() {
+ #[rustfmt::skip]
+ let term = mock_term("\
+ word word word word w\n\
+ ord word word word\
+ ");
+
+ let mut regex = RegexSearch::new("word").unwrap();
+ let start = Point::new(Line(1), Column(4));
+ let end = Point::new(Line(0), Column(0));
+ let match_start = Point::new(Line(0), Column(20));
+ let match_end = Point::new(Line(1), Column(2));
+ assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end));
+ }
}
| Bug: backward search on single line goes in cycles
When using backward search, it sometimes goes in cycles without moving a cursor to some search result. In example video, before resizing, everything works fine, but after resizing, it cycles only on several last elements on the line, instead of cycling through all occurrences
https://github.com/alacritty/alacritty/assets/37012324/34cbb259-9d3d-4de5-83df-f92ca66735ba
### System
OS: Linux, Wayland, Sway
Version: alacritty 0.13.2
### Logs
No logs
| The provided video cannot be played back.
@chrisduerr , I can play it back. Do you use firefox? If so, videos in github with firefox is a known bug. Try downloading video or using another browser :shrug:
Even without video, try to create a long line with like 30 or 40 entries of the same word and try backward-searching this word. Search will break | 2024-06-29T07:36:44 | 1.70 | 5e6b92db85b3ea7ffd06a7a5ae0d2d62ad5946a6 | [
"term::search::tests::inline_word_search"
] | [
"grid::storage::tests::indexing",
"grid::storage::tests::indexing_above_inner_len - should panic",
"grid::storage::tests::rotate",
"grid::storage::tests::rotate_wrap_zero",
"grid::storage::tests::shrink_after_zero",
"grid::storage::tests::shrink_before_and_after_zero",
"grid::storage::tests::shrink_then... | [] | [] | 3 |
alacritty/alacritty | 7,729 | alacritty__alacritty-7729 | [
"7720"
] | c354f58f421c267cc1472414eaaa9f738509ede0 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Autokey no longer working with alacritty on X11
- Freeze when moving window between monitors on Xfwm
- Mouse cursor not changing on Wayland when cursor theme uses legacy cursor icon names
+- Config keys are available under proper names
### Changed
diff --git a/alacritty_config_derive/src/serde_replace.rs b/alacritty_config_derive/src/serde_replace.rs
--- a/alacritty_config_derive/src/serde_replace.rs
+++ b/alacritty_config_derive/src/serde_replace.rs
@@ -44,7 +44,10 @@ pub fn derive_recursive<T>(
) -> TokenStream2 {
let GenericsStreams { unconstrained, constrained, .. } =
crate::generics_streams(&generics.params);
- let replace_arms = match_arms(&fields);
+ let replace_arms = match match_arms(&fields) {
+ Err(e) => return e.to_compile_error(),
+ Ok(replace_arms) => replace_arms,
+ };
quote! {
#[allow(clippy::extra_unused_lifetimes)]
diff --git a/alacritty_config_derive/src/serde_replace.rs b/alacritty_config_derive/src/serde_replace.rs
--- a/alacritty_config_derive/src/serde_replace.rs
+++ b/alacritty_config_derive/src/serde_replace.rs
@@ -75,7 +78,7 @@ pub fn derive_recursive<T>(
}
/// Create SerdeReplace recursive match arms.
-fn match_arms<T>(fields: &Punctuated<Field, T>) -> TokenStream2 {
+fn match_arms<T>(fields: &Punctuated<Field, T>) -> Result<TokenStream2, syn::Error> {
let mut stream = TokenStream2::default();
let mut flattened_arm = None;
diff --git a/alacritty_config_derive/src/serde_replace.rs b/alacritty_config_derive/src/serde_replace.rs
--- a/alacritty_config_derive/src/serde_replace.rs
+++ b/alacritty_config_derive/src/serde_replace.rs
@@ -88,19 +91,42 @@ fn match_arms<T>(fields: &Punctuated<Field, T>) -> TokenStream2 {
let flatten = field
.attrs
.iter()
+ .filter(|attr| (*attr).path().is_ident("config"))
.filter_map(|attr| attr.parse_args::<Attr>().ok())
.any(|parsed| parsed.ident.as_str() == "flatten");
if flatten && flattened_arm.is_some() {
- return Error::new(ident.span(), MULTIPLE_FLATTEN_ERROR).to_compile_error();
+ return Err(Error::new(ident.span(), MULTIPLE_FLATTEN_ERROR));
} else if flatten {
flattened_arm = Some(quote! {
_ => alacritty_config::SerdeReplace::replace(&mut self.#ident, value)?,
});
} else {
+ // Extract all `#[config(alias = "...")]` attribute values.
+ let aliases = field
+ .attrs
+ .iter()
+ .filter(|attr| (*attr).path().is_ident("config"))
+ .filter_map(|attr| attr.parse_args::<Attr>().ok())
+ .filter(|parsed| parsed.ident.as_str() == "alias")
+ .map(|parsed| {
+ let value = parsed
+ .param
+ .ok_or_else(|| format!("Field \"{}\" has no alias value", ident))?
+ .value();
+
+ if value.trim().is_empty() {
+ return Err(format!("Field \"{}\" has an empty alias value", ident));
+ }
+
+ Ok(value)
+ })
+ .collect::<Result<Vec<String>, String>>()
+ .map_err(|msg| Error::new(ident.span(), msg))?;
+
stream.extend(quote! {
- #literal => alacritty_config::SerdeReplace::replace(&mut self.#ident, next_value)?,
- });
+ #(#aliases)|* | #literal => alacritty_config::SerdeReplace::replace(&mut
+ self.#ident, next_value)?, });
}
}
diff --git a/alacritty_config_derive/src/serde_replace.rs b/alacritty_config_derive/src/serde_replace.rs
--- a/alacritty_config_derive/src/serde_replace.rs
+++ b/alacritty_config_derive/src/serde_replace.rs
@@ -109,5 +135,5 @@ fn match_arms<T>(fields: &Punctuated<Field, T>) -> TokenStream2 {
stream.extend(flattened_arm);
}
- stream
+ Ok(stream)
}
| diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs
--- a/alacritty_config_derive/tests/config.rs
+++ b/alacritty_config_derive/tests/config.rs
@@ -23,7 +23,7 @@ impl Default for TestEnum {
#[derive(ConfigDeserialize)]
struct Test {
- #[config(alias = "noalias")]
+ #[config(alias = "field1_alias")]
#[config(deprecated = "use field2 instead")]
field1: usize,
#[config(deprecated = "shouldn't be hit")]
diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs
--- a/alacritty_config_derive/tests/config.rs
+++ b/alacritty_config_derive/tests/config.rs
@@ -39,6 +39,9 @@ struct Test {
enom_error: TestEnum,
#[config(removed = "it's gone")]
gone: bool,
+ #[config(alias = "multiple_alias1")]
+ #[config(alias = "multiple_alias2")]
+ multiple_alias_field: usize,
}
impl Default for Test {
diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs
--- a/alacritty_config_derive/tests/config.rs
+++ b/alacritty_config_derive/tests/config.rs
@@ -53,6 +56,7 @@ impl Default for Test {
enom_big: TestEnum::default(),
enom_error: TestEnum::default(),
gone: false,
+ multiple_alias_field: 0,
}
}
}
diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs
--- a/alacritty_config_derive/tests/config.rs
+++ b/alacritty_config_derive/tests/config.rs
@@ -70,6 +74,7 @@ struct Test2<T: Default> {
#[derive(ConfigDeserialize, Default)]
struct Test3 {
+ #[config(alias = "flatty_alias")]
flatty: usize,
}
diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs
--- a/alacritty_config_derive/tests/config.rs
+++ b/alacritty_config_derive/tests/config.rs
@@ -189,6 +194,33 @@ fn replace_derive() {
assert_eq!(test.nesting.newtype, NewType(9));
}
+#[test]
+fn replace_derive_using_alias() {
+ let mut test = Test::default();
+
+ assert_ne!(test.field1, 9);
+
+ let value = toml::from_str("field1_alias=9").unwrap();
+ test.replace(value).unwrap();
+
+ assert_eq!(test.field1, 9);
+}
+
+#[test]
+fn replace_derive_using_multiple_aliases() {
+ let mut test = Test::default();
+
+ let toml_value = toml::from_str("multiple_alias1=6").unwrap();
+ test.replace(toml_value).unwrap();
+
+ assert_eq!(test.multiple_alias_field, 6);
+
+ let toml_value = toml::from_str("multiple_alias1=7").unwrap();
+ test.replace(toml_value).unwrap();
+
+ assert_eq!(test.multiple_alias_field, 7);
+}
+
#[test]
fn replace_flatten() {
let mut test = Test::default();
diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs
--- a/alacritty_config_derive/tests/config.rs
+++ b/alacritty_config_derive/tests/config.rs
@@ -198,3 +230,15 @@ fn replace_flatten() {
assert_eq!(test.flatten.flatty, 7);
}
+
+#[test]
+fn replace_flatten_using_alias() {
+ let mut test = Test::default();
+
+ assert_ne!(test.flatten.flatty, 7);
+
+ let value = toml::from_str("flatty_alias=7").unwrap();
+ test.replace(value).unwrap();
+
+ assert_eq!(test.flatten.flatty, 7);
+}
| CLI -o config overrides should accept aliases as documented
### Expected behavior
As indicated by `man alacritty`, the `-o` option can be used to override configuration from the `alacritty.toml` config file with the properties specified by `man 5 alacritty`. One would therefore expect that
```alacritty -o 'colors.cursor.cursor="CellBackground"'```
leads to an invisible cursor.
### Actual behavior
Instead, it gives the error
```Unable to override option 'colors.cursor.cursor="CellBackground"': Field 'cursor' does not exist```
and no change to the background color is effected.
### Workaround
Inspecting the source code, this appears to stem from the fact that the `colors.cursor` configuration option is an `InvertedCellColors` struct, for which `cursor` is an alias for a property named `background`. Indeed,
```alacritty -o 'colors.cursor.background="CellBackground"'```
yields the desired result. The `-o` overrides should resolve those aliases since only the aliases are used in the documentation.
### Possible cause
Digging a bit deeper, I think the relevant part of the code is the function `derive_deserialize` in `alacritty/alacritty_config_derive/src/config_deserialize/de_struct.rs` which implements `SerdeReplace` without using the result of `fields_deserializer` which includes the substitution of aliases.
### System
OS: Linux 6.7.4-arch1-1
Version: alacritty 0.13.1 (fe2a3c56)
Compositor: sway
| The problem is [here](https://github.com/alacritty/alacritty/blob/master/alacritty_config_derive/src/serde_replace.rs#L51).
This is what's generated when I look with `cargo expand`:
```rust
#[allow(clippy::extra_unused_lifetimes)]
impl<'de> alacritty_config::SerdeReplace for InvertedCellColors {
fn replace(
&mut self,
value: toml::Value,
) -> Result<(), Box<dyn std::error::Error>> {
match value.as_table() {
Some(table) => {
for (field, next_value) in table {
let next_value = next_value.clone();
let value = value.clone();
match field.as_str() {
"foreground" => {
alacritty_config::SerdeReplace::replace(
&mut self.foreground,
next_value,
)?
}
"background" => {
alacritty_config::SerdeReplace::replace(
&mut self.background,
next_value,
)?
}
_ => {
let error = {
let res = ::alloc::fmt::format(
format_args!("Field \"{0}\" does not exist", field),
);
res
};
return Err(error.into());
}
}
}
}
None => *self = serde::Deserialize::deserialize(value)?,
}
Ok(())
}
}
```
The `alias=cursor` is not used in the replace | 2024-02-14T03:46:11 | 1.72 | 41d2f1df4509148a6f1ffb3de59c2389a3a93283 | [
"replace_derive_using_alias",
"replace_derive_using_multiple_aliases",
"replace_flatten_using_alias"
] | [
"replace_derive",
"field_replacement",
"replace_flatten",
"config_deserialize"
] | [] | [] | 4 |
alacritty/alacritty | 7,204 | alacritty__alacritty-7204 | [
"7097"
] | 77aa9f42bac4377efe26512d71098d21b9b547fd | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Cut off wide characters in preedit string
- Scrolling on touchscreens
- Double clicking on CSD titlebar not always maximizing a window on Wayland
+- Excessive memory usage when using regexes with a large number of possible states
### Removed
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs
--- a/alacritty/src/config/ui_config.rs
+++ b/alacritty/src/config/ui_config.rs
@@ -485,7 +485,7 @@ impl LazyRegex {
/// Execute a function with the compiled regex DFAs as parameter.
pub fn with_compiled<T, F>(&self, f: F) -> Option<T>
where
- F: FnMut(&RegexSearch) -> T,
+ F: FnMut(&mut RegexSearch) -> T,
{
self.0.borrow_mut().compiled().map(f)
}
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs
--- a/alacritty/src/config/ui_config.rs
+++ b/alacritty/src/config/ui_config.rs
@@ -514,7 +514,7 @@ impl LazyRegexVariant {
///
/// If the regex is not already compiled, this will compile the DFAs and store them for future
/// access.
- fn compiled(&mut self) -> Option<&RegexSearch> {
+ fn compiled(&mut self) -> Option<&mut RegexSearch> {
// Check if the regex has already been compiled.
let regex = match self {
Self::Compiled(regex_search) => return Some(regex_search),
diff --git a/alacritty/src/display/content.rs b/alacritty/src/display/content.rs
--- a/alacritty/src/display/content.rs
+++ b/alacritty/src/display/content.rs
@@ -41,7 +41,7 @@ impl<'a> RenderableContent<'a> {
config: &'a UiConfig,
display: &'a mut Display,
term: &'a Term<T>,
- search_state: &'a SearchState,
+ search_state: &'a mut SearchState,
) -> Self {
let search = search_state.dfas().map(|dfas| HintMatches::visible_regex_matches(term, dfas));
let focused_match = search_state.focused_match();
diff --git a/alacritty/src/display/content.rs b/alacritty/src/display/content.rs
--- a/alacritty/src/display/content.rs
+++ b/alacritty/src/display/content.rs
@@ -486,7 +486,7 @@ impl<'a> HintMatches<'a> {
}
/// Create from regex matches on term visable part.
- fn visible_regex_matches<T>(term: &Term<T>, dfas: &RegexSearch) -> Self {
+ fn visible_regex_matches<T>(term: &Term<T>, dfas: &mut RegexSearch) -> Self {
let matches = hint::visible_regex_match_iter(term, dfas).collect::<Vec<_>>();
Self::new(matches)
}
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -90,7 +90,8 @@ impl HintState {
// Apply post-processing and search for sub-matches if necessary.
if hint.post_processing {
- self.matches.extend(matches.flat_map(|rm| {
+ let mut matches = matches.collect::<Vec<_>>();
+ self.matches.extend(matches.drain(..).flat_map(|rm| {
HintPostProcessor::new(term, regex, rm).collect::<Vec<_>>()
}));
} else {
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -289,7 +290,7 @@ impl HintLabels {
/// Iterate over all visible regex matches.
pub fn visible_regex_match_iter<'a, T>(
term: &'a Term<T>,
- regex: &'a RegexSearch,
+ regex: &'a mut RegexSearch,
) -> impl Iterator<Item = Match> + 'a {
let viewport_start = Line(-(term.grid().display_offset() as i32));
let viewport_end = viewport_start + term.bottommost_line();
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -344,7 +345,7 @@ pub fn visible_unique_hyperlinks_iter<T>(term: &Term<T>) -> impl Iterator<Item =
fn regex_match_at<T>(
term: &Term<T>,
point: Point,
- regex: &RegexSearch,
+ regex: &mut RegexSearch,
post_processing: bool,
) -> Option<Match> {
let regex_match = visible_regex_match_iter(term, regex).find(|rm| rm.contains(&point))?;
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -450,7 +451,7 @@ fn hyperlink_at<T>(term: &Term<T>, point: Point) -> Option<(Hyperlink, Match)> {
/// Iterator over all post-processed matches inside an existing hint match.
struct HintPostProcessor<'a, T> {
/// Regex search DFAs.
- regex: &'a RegexSearch,
+ regex: &'a mut RegexSearch,
/// Terminal reference.
term: &'a Term<T>,
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -467,7 +468,7 @@ struct HintPostProcessor<'a, T> {
impl<'a, T> HintPostProcessor<'a, T> {
/// Create a new iterator for an unprocessed match.
- fn new(term: &'a Term<T>, regex: &'a RegexSearch, regex_match: Match) -> Self {
+ fn new(term: &'a Term<T>, regex: &'a mut RegexSearch, regex_match: Match) -> Self {
let mut post_processor = Self {
next_match: None,
start: *regex_match.start(),
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -759,7 +759,7 @@ impl Display {
scheduler: &mut Scheduler,
message_buffer: &MessageBuffer,
config: &UiConfig,
- search_state: &SearchState,
+ search_state: &mut SearchState,
) {
// Collect renderable content before the terminal is dropped.
let mut content = RenderableContent::new(config, self, &terminal, search_state);
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -154,8 +154,8 @@ impl SearchState {
}
/// Active search dfas.
- pub fn dfas(&self) -> Option<&RegexSearch> {
- self.dfas.as_ref()
+ pub fn dfas(&mut self) -> Option<&mut RegexSearch> {
+ self.dfas.as_mut()
}
/// Search regex text if a search is active.
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -637,7 +637,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
fn search_next(&mut self, origin: Point, direction: Direction, side: Side) -> Option<Match> {
self.search_state
.dfas
- .as_ref()
+ .as_mut()
.and_then(|dfas| self.terminal.search_next(dfas, origin, direction, side, None))
}
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -913,7 +913,7 @@ impl<'a, N: Notify + 'a, T: EventListener> ActionContext<'a, N, T> {
/// Jump to the first regex match from the search origin.
fn goto_match(&mut self, mut limit: Option<usize>) {
- let dfas = match &self.search_state.dfas {
+ let dfas = match &mut self.search_state.dfas {
Some(dfas) => dfas,
None => return,
};
diff --git a/alacritty/src/window_context.rs b/alacritty/src/window_context.rs
--- a/alacritty/src/window_context.rs
+++ b/alacritty/src/window_context.rs
@@ -398,7 +398,7 @@ impl WindowContext {
scheduler,
&self.message_buffer,
&self.config,
- &self.search_state,
+ &mut self.search_state,
);
}
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -1,10 +1,11 @@
use std::cmp::max;
+use std::error::Error;
use std::mem;
use std::ops::RangeInclusive;
-pub use regex_automata::dfa::dense::BuildError;
-use regex_automata::dfa::dense::{Builder, Config, DFA};
-use regex_automata::dfa::Automaton;
+use log::{debug, warn};
+use regex_automata::hybrid::dfa::{Builder, Cache, Config, DFA};
+pub use regex_automata::hybrid::BuildError;
use regex_automata::nfa::thompson::Config as ThompsonConfig;
use regex_automata::util::syntax::Config as SyntaxConfig;
use regex_automata::{Anchored, Input};
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -17,38 +18,59 @@ use crate::term::Term;
/// Used to match equal brackets, when performing a bracket-pair selection.
const BRACKET_PAIRS: [(char, char); 4] = [('(', ')'), ('[', ']'), ('{', '}'), ('<', '>')];
-/// Maximum DFA size to prevent pathological regexes taking down the entire system.
-const MAX_DFA_SIZE: usize = 100_000_000;
-
pub type Match = RangeInclusive<Point>;
/// Terminal regex search state.
#[derive(Clone, Debug)]
pub struct RegexSearch {
- dfa: DFA<Vec<u32>>,
- rdfa: DFA<Vec<u32>>,
+ fdfa: LazyDfa,
+ rdfa: LazyDfa,
}
impl RegexSearch {
/// Build the forward and backward search DFAs.
pub fn new(search: &str) -> Result<RegexSearch, Box<BuildError>> {
// Setup configs for both DFA directions.
+ //
+ // Bounds are based on Regex's meta engine:
+ // https://github.com/rust-lang/regex/blob/061ee815ef2c44101dba7b0b124600fcb03c1912/regex-automata/src/meta/wrappers.rs#L581-L599
let has_uppercase = search.chars().any(|c| c.is_uppercase());
let syntax_config = SyntaxConfig::new().case_insensitive(!has_uppercase);
- let config = Config::new().dfa_size_limit(Some(MAX_DFA_SIZE));
+ let config =
+ Config::new().minimum_cache_clear_count(Some(3)).minimum_bytes_per_state(Some(10));
+ let max_size = config.get_cache_capacity();
+ let mut thompson_config = ThompsonConfig::new().nfa_size_limit(Some(max_size));
// Create Regex DFA for left-to-right search.
- let dfa = Builder::new().configure(config.clone()).syntax(syntax_config).build(search)?;
+ let fdfa = Builder::new()
+ .configure(config.clone())
+ .syntax(syntax_config)
+ .thompson(thompson_config.clone())
+ .build(search)?;
// Create Regex DFA for right-to-left search.
- let thompson_config = ThompsonConfig::new().reverse(true);
+ thompson_config = thompson_config.reverse(true);
let rdfa = Builder::new()
.configure(config)
.syntax(syntax_config)
.thompson(thompson_config)
.build(search)?;
- Ok(RegexSearch { dfa, rdfa })
+ Ok(RegexSearch { fdfa: fdfa.into(), rdfa: rdfa.into() })
+ }
+}
+
+/// Runtime-evaluated DFA.
+#[derive(Clone, Debug)]
+struct LazyDfa {
+ dfa: DFA,
+ cache: Cache,
+}
+
+impl From<DFA> for LazyDfa {
+ fn from(dfa: DFA) -> Self {
+ let cache = dfa.create_cache();
+ Self { dfa, cache }
}
}
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -56,7 +78,7 @@ impl<T> Term<T> {
/// Get next search match in the specified direction.
pub fn search_next(
&self,
- regex: &RegexSearch,
+ regex: &mut RegexSearch,
mut origin: Point,
direction: Direction,
side: Side,
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -75,7 +97,7 @@ impl<T> Term<T> {
/// Find the next match to the right of the origin.
fn next_match_right(
&self,
- regex: &RegexSearch,
+ regex: &mut RegexSearch,
origin: Point,
side: Side,
max_lines: Option<usize>,
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -114,7 +136,7 @@ impl<T> Term<T> {
/// Find the next match to the left of the origin.
fn next_match_left(
&self,
- regex: &RegexSearch,
+ regex: &mut RegexSearch,
origin: Point,
side: Side,
max_lines: Option<usize>,
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -163,14 +185,14 @@ impl<T> Term<T> {
/// The origin is always included in the regex.
pub fn regex_search_left(
&self,
- regex: &RegexSearch,
+ regex: &mut RegexSearch,
start: Point,
end: Point,
) -> Option<Match> {
// Find start and end of match.
- let match_start = self.regex_search(start, end, Direction::Left, false, ®ex.rdfa)?;
+ let match_start = self.regex_search(start, end, Direction::Left, false, &mut regex.rdfa)?;
let match_end =
- self.regex_search(match_start, start, Direction::Right, true, ®ex.dfa)?;
+ self.regex_search(match_start, start, Direction::Right, true, &mut regex.fdfa)?;
Some(match_start..=match_end)
}
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -180,14 +202,14 @@ impl<T> Term<T> {
/// The origin is always included in the regex.
pub fn regex_search_right(
&self,
- regex: &RegexSearch,
+ regex: &mut RegexSearch,
start: Point,
end: Point,
) -> Option<Match> {
// Find start and end of match.
- let match_end = self.regex_search(start, end, Direction::Right, false, ®ex.dfa)?;
+ let match_end = self.regex_search(start, end, Direction::Right, false, &mut regex.fdfa)?;
let match_start =
- self.regex_search(match_end, start, Direction::Left, true, ®ex.rdfa)?;
+ self.regex_search(match_end, start, Direction::Left, true, &mut regex.rdfa)?;
Some(match_start..=match_end)
}
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -201,8 +223,29 @@ impl<T> Term<T> {
end: Point,
direction: Direction,
anchored: bool,
- regex: &impl Automaton,
+ regex: &mut LazyDfa,
) -> Option<Point> {
+ match self.regex_search_internal(start, end, direction, anchored, regex) {
+ Ok(regex_match) => regex_match,
+ Err(err) => {
+ warn!("Regex exceeded complexity limit");
+ debug!(" {err}");
+ None
+ },
+ }
+ }
+
+ /// Find the next regex match.
+ ///
+ /// To automatically log regex complexity errors, use [`Self::regex_search`] instead.
+ fn regex_search_internal(
+ &self,
+ start: Point,
+ end: Point,
+ direction: Direction,
+ anchored: bool,
+ regex: &mut LazyDfa,
+ ) -> Result<Option<Point>, Box<dyn Error>> {
let topmost_line = self.topmost_line();
let screen_lines = self.screen_lines() as i32;
let last_column = self.last_column();
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -216,8 +259,7 @@ impl<T> Term<T> {
// Get start state for the DFA.
let regex_anchored = if anchored { Anchored::Yes } else { Anchored::No };
let input = Input::new(&[]).anchored(regex_anchored);
- let start_state = regex.start_state_forward(&input).unwrap();
- let mut state = start_state;
+ let mut state = regex.dfa.start_state_forward(&mut regex.cache, &input).unwrap();
let mut iter = self.grid.iter_from(start);
let mut last_wrapped = false;
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -244,19 +286,18 @@ impl<T> Term<T> {
Direction::Left => buf[utf8_len - i - 1],
};
- // Since we get the state from the DFA, it doesn't need to be checked.
- state = unsafe { regex.next_state_unchecked(state, byte) };
+ state = regex.dfa.next_state(&mut regex.cache, state, byte)?;
// Matches require one additional BYTE of lookahead, so we check the match state for
// the first byte of every new character to determine if the last character was a
// match.
- if i == 0 && regex.is_match_state(state) {
+ if i == 0 && state.is_match() {
regex_match = Some(last_point);
}
}
// Abort on dead states.
- if regex.is_dead_state(state) {
+ if state.is_dead() {
break;
}
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -264,8 +305,8 @@ impl<T> Term<T> {
if point == end || done {
// When reaching the end-of-input, we need to notify the parser that no look-ahead
// is possible and check if the current state is still a match.
- state = regex.next_eoi_state(state);
- if regex.is_match_state(state) {
+ state = regex.dfa.next_eoi_state(&mut regex.cache, state)?;
+ if state.is_match() {
regex_match = Some(point);
}
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -303,12 +344,12 @@ impl<T> Term<T> {
None => {
// When reaching the end-of-input, we need to notify the parser that no
// look-ahead is possible and check if the current state is still a match.
- state = regex.next_eoi_state(state);
- if regex.is_match_state(state) {
+ state = regex.dfa.next_eoi_state(&mut regex.cache, state)?;
+ if state.is_match() {
regex_match = Some(last_point);
}
- state = start_state;
+ state = regex.dfa.start_state_forward(&mut regex.cache, &input)?;
},
}
}
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -316,7 +357,7 @@ impl<T> Term<T> {
last_wrapped = wrapped;
}
- regex_match
+ Ok(regex_match)
}
/// Advance a grid iterator over fullwidth characters.
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -478,7 +519,7 @@ pub struct RegexIter<'a, T> {
point: Point,
end: Point,
direction: Direction,
- regex: &'a RegexSearch,
+ regex: &'a mut RegexSearch,
term: &'a Term<T>,
done: bool,
}
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -489,7 +530,7 @@ impl<'a, T> RegexIter<'a, T> {
end: Point,
direction: Direction,
term: &'a Term<T>,
- regex: &'a RegexSearch,
+ regex: &'a mut RegexSearch,
) -> Self {
Self { point: start, done: false, end, direction, term, regex }
}
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -505,7 +546,7 @@ impl<'a, T> RegexIter<'a, T> {
}
/// Get the next match in the specified direction.
- fn next_match(&self) -> Option<Match> {
+ fn next_match(&mut self) -> Option<Match> {
match self.direction {
Direction::Right => self.term.regex_search_right(self.regex, self.point, self.end),
Direction::Left => self.term.regex_search_left(self.regex, self.point, self.end),
| diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs
--- a/alacritty/src/config/ui_config.rs
+++ b/alacritty/src/config/ui_config.rs
@@ -578,8 +578,8 @@ mod tests {
"ftp://ftp.example.org",
] {
let term = mock_term(regular_url);
- let regex = RegexSearch::new(URL_REGEX).unwrap();
- let matches = visible_regex_match_iter(&term, ®ex).collect::<Vec<_>>();
+ let mut regex = RegexSearch::new(URL_REGEX).unwrap();
+ let matches = visible_regex_match_iter(&term, &mut regex).collect::<Vec<_>>();
assert_eq!(
matches.len(),
1,
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs
--- a/alacritty/src/config/ui_config.rs
+++ b/alacritty/src/config/ui_config.rs
@@ -599,8 +599,8 @@ mod tests {
"mailto:",
] {
let term = mock_term(url_like);
- let regex = RegexSearch::new(URL_REGEX).unwrap();
- let matches = visible_regex_match_iter(&term, ®ex).collect::<Vec<_>>();
+ let mut regex = RegexSearch::new(URL_REGEX).unwrap();
+ let matches = visible_regex_match_iter(&term, &mut regex).collect::<Vec<_>>();
assert!(
matches.is_empty(),
"Should not match url in string {url_like}, but instead got: {matches:?}"
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -638,11 +639,11 @@ mod tests {
fn closed_bracket_does_not_result_in_infinite_iterator() {
let term = mock_term(" ) ");
- let search = RegexSearch::new("[^/ ]").unwrap();
+ let mut search = RegexSearch::new("[^/ ]").unwrap();
let count = HintPostProcessor::new(
&term,
- &search,
+ &mut search,
Point::new(Line(0), Column(1))..=Point::new(Line(0), Column(1)),
)
.take(1)
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs
--- a/alacritty/src/display/hint.rs
+++ b/alacritty/src/display/hint.rs
@@ -694,9 +695,9 @@ mod tests {
// The Term returned from this call will have a viewport starting at 0 and ending at 4096.
// That's good enough for this test, since it only cares about visible content.
let term = mock_term(&content);
- let regex = RegexSearch::new("match!").unwrap();
+ let mut regex = RegexSearch::new("match!").unwrap();
// The interator should match everything in the viewport.
- assert_eq!(visible_regex_match_iter(&term, ®ex).count(), 4096);
+ assert_eq!(visible_regex_match_iter(&term, &mut regex).count(), 4096);
}
}
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -561,12 +602,12 @@ mod tests {
");
// Check regex across wrapped and unwrapped lines.
- let regex = RegexSearch::new("Ala.*123").unwrap();
+ let mut regex = RegexSearch::new("Ala.*123").unwrap();
let start = Point::new(Line(1), Column(0));
let end = Point::new(Line(4), Column(2));
let match_start = Point::new(Line(1), Column(0));
let match_end = Point::new(Line(2), Column(2));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(match_start..=match_end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=match_end));
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -581,12 +622,12 @@ mod tests {
");
// Check regex across wrapped and unwrapped lines.
- let regex = RegexSearch::new("Ala.*123").unwrap();
+ let mut regex = RegexSearch::new("Ala.*123").unwrap();
let start = Point::new(Line(4), 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(2), Column(2));
- assert_eq!(term.regex_search_left(®ex, start, end), Some(match_start..=match_end));
+ assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end));
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -598,16 +639,16 @@ mod tests {
");
// Greedy stopped at linebreak.
- let regex = RegexSearch::new("Ala.*critty").unwrap();
+ let mut regex = RegexSearch::new("Ala.*critty").unwrap();
let start = Point::new(Line(0), Column(0));
let end = Point::new(Line(0), Column(25));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(start..=end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end));
// Greedy stopped at dead state.
- let regex = RegexSearch::new("Ala[^y]*critty").unwrap();
+ let mut regex = RegexSearch::new("Ala[^y]*critty").unwrap();
let start = Point::new(Line(0), Column(0));
let end = Point::new(Line(0), Column(15));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(start..=end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end));
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -619,10 +660,10 @@ mod tests {
third\
");
- let regex = RegexSearch::new("nothing").unwrap();
+ let mut regex = RegexSearch::new("nothing").unwrap();
let start = Point::new(Line(0), Column(0));
let end = Point::new(Line(2), Column(4));
- assert_eq!(term.regex_search_right(®ex, start, end), None);
+ assert_eq!(term.regex_search_right(&mut regex, start, end), None);
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -634,10 +675,10 @@ mod tests {
third\
");
- let regex = RegexSearch::new("nothing").unwrap();
+ let mut regex = RegexSearch::new("nothing").unwrap();
let start = Point::new(Line(2), Column(4));
let end = Point::new(Line(0), Column(0));
- assert_eq!(term.regex_search_left(®ex, start, end), None);
+ assert_eq!(term.regex_search_left(&mut regex, start, end), None);
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -649,12 +690,12 @@ mod tests {
");
// Make sure the cell containing the linebreak is not skipped.
- let regex = RegexSearch::new("te.*123").unwrap();
+ let mut regex = RegexSearch::new("te.*123").unwrap();
let start = Point::new(Line(1), Column(0));
let end = Point::new(Line(0), Column(0));
let match_start = Point::new(Line(0), Column(0));
let match_end = Point::new(Line(0), Column(9));
- assert_eq!(term.regex_search_left(®ex, start, end), Some(match_start..=match_end));
+ assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end));
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -666,11 +707,11 @@ mod tests {
");
// Make sure the cell containing the linebreak is not skipped.
- let regex = RegexSearch::new("te.*123").unwrap();
+ let mut regex = RegexSearch::new("te.*123").unwrap();
let start = Point::new(Line(0), Column(2));
let end = Point::new(Line(1), Column(9));
let match_start = Point::new(Line(1), Column(0));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(match_start..=end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=end));
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -678,10 +719,10 @@ mod tests {
let term = mock_term("alacritty");
// Make sure dead state cell is skipped when reversing.
- let regex = RegexSearch::new("alacrit").unwrap();
+ let mut regex = RegexSearch::new("alacrit").unwrap();
let start = Point::new(Line(0), Column(0));
let end = Point::new(Line(0), Column(6));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(start..=end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end));
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -689,68 +730,68 @@ mod tests {
let term = mock_term("zooo lense");
// Make sure the reverse DFA operates the same as a forward DFA.
- let regex = RegexSearch::new("zoo").unwrap();
+ let mut regex = RegexSearch::new("zoo").unwrap();
let start = Point::new(Line(0), Column(9));
let end = Point::new(Line(0), Column(0));
let match_start = Point::new(Line(0), Column(0));
let match_end = Point::new(Line(0), Column(2));
- assert_eq!(term.regex_search_left(®ex, start, end), Some(match_start..=match_end));
+ assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end));
}
#[test]
fn multibyte_unicode() {
let term = mock_term("testвосибing");
- let regex = RegexSearch::new("te.*ing").unwrap();
+ let mut regex = RegexSearch::new("te.*ing").unwrap();
let start = Point::new(Line(0), Column(0));
let end = Point::new(Line(0), Column(11));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(start..=end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end));
- let regex = RegexSearch::new("te.*ing").unwrap();
+ let mut regex = RegexSearch::new("te.*ing").unwrap();
let start = Point::new(Line(0), Column(11));
let end = Point::new(Line(0), Column(0));
- assert_eq!(term.regex_search_left(®ex, start, end), Some(end..=start));
+ assert_eq!(term.regex_search_left(&mut regex, start, end), Some(end..=start));
}
#[test]
fn end_on_multibyte_unicode() {
let term = mock_term("testвосиб");
- let regex = RegexSearch::new("te.*и").unwrap();
+ let mut regex = RegexSearch::new("te.*и").unwrap();
let start = Point::new(Line(0), Column(0));
let end = Point::new(Line(0), Column(8));
let match_end = Point::new(Line(0), Column(7));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(start..=match_end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=match_end));
}
#[test]
fn fullwidth() {
let term = mock_term("a🦇x🦇");
- let regex = RegexSearch::new("[^ ]*").unwrap();
+ let mut regex = RegexSearch::new("[^ ]*").unwrap();
let start = Point::new(Line(0), Column(0));
let end = Point::new(Line(0), Column(5));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(start..=end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end));
- let regex = RegexSearch::new("[^ ]*").unwrap();
+ let mut regex = RegexSearch::new("[^ ]*").unwrap();
let start = Point::new(Line(0), Column(5));
let end = Point::new(Line(0), Column(0));
- assert_eq!(term.regex_search_left(®ex, start, end), Some(end..=start));
+ assert_eq!(term.regex_search_left(&mut regex, start, end), Some(end..=start));
}
#[test]
fn singlecell_fullwidth() {
let term = mock_term("🦇");
- let regex = RegexSearch::new("🦇").unwrap();
+ let mut regex = RegexSearch::new("🦇").unwrap();
let start = Point::new(Line(0), Column(0));
let end = Point::new(Line(0), Column(1));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(start..=end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end));
- let regex = RegexSearch::new("🦇").unwrap();
+ let mut regex = RegexSearch::new("🦇").unwrap();
let start = Point::new(Line(0), Column(1));
let end = Point::new(Line(0), Column(0));
- assert_eq!(term.regex_search_left(®ex, start, end), Some(end..=start));
+ assert_eq!(term.regex_search_left(&mut regex, start, end), Some(end..=start));
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -761,16 +802,16 @@ mod tests {
let end = Point::new(Line(0), Column(4));
// Ensure ending without a match doesn't loop indefinitely.
- let regex = RegexSearch::new("x").unwrap();
- assert_eq!(term.regex_search_right(®ex, start, end), None);
+ let mut regex = RegexSearch::new("x").unwrap();
+ assert_eq!(term.regex_search_right(&mut regex, start, end), None);
- let regex = RegexSearch::new("x").unwrap();
+ let mut regex = RegexSearch::new("x").unwrap();
let match_end = Point::new(Line(0), Column(5));
- assert_eq!(term.regex_search_right(®ex, start, match_end), None);
+ assert_eq!(term.regex_search_right(&mut regex, start, match_end), None);
// Ensure match is captured when only partially inside range.
- let regex = RegexSearch::new("jarr🦇").unwrap();
- assert_eq!(term.regex_search_right(®ex, start, end), Some(start..=match_end));
+ let mut regex = RegexSearch::new("jarr🦇").unwrap();
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=match_end));
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -781,17 +822,17 @@ mod tests {
xxx\
");
- let regex = RegexSearch::new("xxx").unwrap();
+ let mut regex = RegexSearch::new("xxx").unwrap();
let start = Point::new(Line(0), Column(2));
let end = Point::new(Line(1), Column(2));
let match_start = Point::new(Line(1), Column(0));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(match_start..=end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=end));
- let regex = RegexSearch::new("xxx").unwrap();
+ let mut regex = RegexSearch::new("xxx").unwrap();
let start = Point::new(Line(1), Column(0));
let end = Point::new(Line(0), Column(0));
let match_end = Point::new(Line(0), Column(2));
- assert_eq!(term.regex_search_left(®ex, start, end), Some(end..=match_end));
+ assert_eq!(term.regex_search_left(&mut regex, start, end), Some(end..=match_end));
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -802,19 +843,19 @@ mod tests {
xx🦇\
");
- let regex = RegexSearch::new("🦇x").unwrap();
+ let mut regex = RegexSearch::new("🦇x").unwrap();
let start = Point::new(Line(0), Column(0));
let end = Point::new(Line(1), Column(3));
let match_start = Point::new(Line(0), Column(0));
let match_end = Point::new(Line(0), Column(2));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(match_start..=match_end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=match_end));
- let regex = RegexSearch::new("x🦇").unwrap();
+ let mut regex = RegexSearch::new("x🦇").unwrap();
let start = Point::new(Line(1), Column(2));
let end = Point::new(Line(0), Column(0));
let match_start = Point::new(Line(1), Column(1));
let match_end = Point::new(Line(1), Column(3));
- assert_eq!(term.regex_search_left(®ex, start, end), Some(match_start..=match_end));
+ assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end));
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -826,33 +867,33 @@ mod tests {
");
term.grid[Line(0)][Column(3)].flags.insert(Flags::LEADING_WIDE_CHAR_SPACER);
- let regex = RegexSearch::new("🦇x").unwrap();
+ let mut regex = RegexSearch::new("🦇x").unwrap();
let start = Point::new(Line(0), Column(0));
let end = Point::new(Line(1), Column(3));
let match_start = Point::new(Line(0), Column(3));
let match_end = Point::new(Line(1), Column(2));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(match_start..=match_end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=match_end));
- let regex = RegexSearch::new("🦇x").unwrap();
+ let mut regex = RegexSearch::new("🦇x").unwrap();
let start = Point::new(Line(1), Column(3));
let end = Point::new(Line(0), Column(0));
let match_start = Point::new(Line(0), Column(3));
let match_end = Point::new(Line(1), Column(2));
- assert_eq!(term.regex_search_left(®ex, start, end), Some(match_start..=match_end));
+ assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end));
- let regex = RegexSearch::new("x🦇").unwrap();
+ let mut regex = RegexSearch::new("x🦇").unwrap();
let start = Point::new(Line(0), Column(0));
let end = Point::new(Line(1), Column(3));
let match_start = Point::new(Line(0), Column(2));
let match_end = Point::new(Line(1), Column(1));
- assert_eq!(term.regex_search_right(®ex, start, end), Some(match_start..=match_end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=match_end));
- let regex = RegexSearch::new("x🦇").unwrap();
+ let mut regex = RegexSearch::new("x🦇").unwrap();
let start = Point::new(Line(1), Column(3));
let end = Point::new(Line(0), Column(0));
let match_start = Point::new(Line(0), Column(2));
let match_end = Point::new(Line(1), Column(1));
- assert_eq!(term.regex_search_left(®ex, start, end), Some(match_start..=match_end));
+ assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end));
}
#[test]
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -863,12 +904,12 @@ mod tests {
term.grid[Line(0)][Column(1)].c = '字';
term.grid[Line(0)][Column(1)].flags = Flags::WIDE_CHAR;
- let regex = RegexSearch::new("test").unwrap();
+ let mut regex = RegexSearch::new("test").unwrap();
let start = Point::new(Line(0), Column(0));
let end = Point::new(Line(0), Column(1));
- let mut iter = RegexIter::new(start, end, Direction::Right, &term, ®ex);
+ let mut iter = RegexIter::new(start, end, Direction::Right, &term, &mut regex);
assert_eq!(iter.next(), None);
}
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs
--- a/alacritty_terminal/src/term/search.rs
+++ b/alacritty_terminal/src/term/search.rs
@@ -881,19 +922,34 @@ mod tests {
");
// Bottom to top.
- let regex = RegexSearch::new("abc").unwrap();
+ let mut regex = 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(®ex, start, end), Some(match_start..=match_end));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=match_end));
// Top to bottom.
- let regex = RegexSearch::new("def").unwrap();
+ let mut regex = 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(®ex, start, end), Some(match_start..=match_end));
+ assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end));
+ }
+
+ #[test]
+ fn nfa_compile_error() {
+ assert!(RegexSearch::new("[0-9A-Za-z]{9999999}").is_err());
+ }
+
+ #[test]
+ fn runtime_cache_error() {
+ let term = mock_term(&str::repeat("i", 9999));
+
+ let mut regex = RegexSearch::new("[0-9A-Za-z]{9999}").unwrap();
+ let start = Point::new(Line(0), Column(0));
+ let end = Point::new(Line(0), Column(9999));
+ assert_eq!(term.regex_search_right(&mut regex, start, end), None);
}
}
| Hint regex with large chars amount. Hanging and continues memory consumption
### Problem
With the `Qm[0-9A-Za-z]{44}` as a hint regex pattern, Alacritty hangs upon activating Hints and memory consumption starts to growth continuously.
```yml
# ... rest of the config
hints:
enabled:
- regex: 'Qm[0-9A-Za-z]{44}'
action: Copy
binding:
key: U
mods: Control|Shift
```
But no issues with `sha256:([0-9a-f]{64})` pattern.
```yml
# ... rest of the config
hints:
enabled:
- regex: 'sha256:([0-9a-f]{64})'
action: Copy
binding:
key: U
mods: Control|Shift
```
No any hangs, hints highlighted almost immediately
### System
Version: 0.12.2
OS: Ubuntu 20.04
Compositor: compton
WM: xmonad
### Logs
Crashes: NONE
Font/Terminal size:
[screenshot](https://github.com/alacritty/alacritty/assets/29537473/e70f66a4-9ef0-4e26-b012-0c8c985db0b0)
Keyboard and bindings:
After activating Hints with the mentioned pattern Alacritty hangs and stops reporting any events with `--report-events` option
| Going to remove high priority from this since it shouldn't cause complete destruction anymore. But I still think we can probably do better. Potentially a lazily evaluated regex might perform more reasonably. | 2023-09-09T05:15:52 | 1.65 | 77aa9f42bac4377efe26512d71098d21b9b547fd | [
"term::search::tests::runtime_cache_error"
] | [
"grid::storage::tests::indexing",
"grid::storage::tests::rotate_wrap_zero",
"grid::storage::tests::rotate",
"grid::storage::tests::shrink_after_zero",
"grid::storage::tests::indexing_above_inner_len - should panic",
"grid::storage::tests::shrink_before_and_after_zero",
"grid::storage::tests::shrink_befo... | [] | [] | 5 |
alacritty/alacritty | 5,870 | alacritty__alacritty-5870 | [
"5840"
] | 8a26dee0a9167777709935789b95758e36885617 | "diff --git a/CHANGELOG.md b/CHANGELOG.md\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -5,6 +5,27 @@ (...TRUNCATED) | "diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml\n--- a/.builds/freebsd.yml\n+++ b/.builds/fr(...TRUNCATED) | "Alacritty keeps asking for permissions\n### System\r\n\r\nOS: MacOS 12.0.1\r\nVersion: 0.10.0\r\n\r(...TRUNCATED) | 2022-02-10T01:07:06 | 0.10 | 8a26dee0a9167777709935789b95758e36885617 | [
"ansi::tests::parse_osc104_reset_all_colors"
] | ["ansi::tests::parse_control_attribute","ansi::tests::parse_designate_g0_as_line_drawing","ansi::tes(...TRUNCATED) | [] | [] | 6 | |
alacritty/alacritty | 5,788 | alacritty__alacritty-5788 | [
"5542"
] | 60ef17e8e98b0ed219a145881d10ecd6b9f26e85 | "diff --git a/CHANGELOG.md b/CHANGELOG.md\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -19,6 +19,7 @@(...TRUNCATED) | "diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs\n--- a/alacritty_termi(...TRUNCATED) | "problems with OSC 4 and 104\n[Documentation claims that OSC 4 and OSC 104 are supported](https://gi(...TRUNCATED) | "Querying the current value with `?` simply isn't implemented, should be trivial to do though if som(...TRUNCATED) | 2022-01-16T06:10:04 | 1.56 | 589c1e9c6b8830625162af14a9a7aee32c7aade0 | [
"ansi::tests::parse_osc104_reset_all_colors"
] | ["ansi::tests::parse_invalid_legacy_rgb_colors","ansi::tests::parse_designate_g0_as_line_drawing","a(...TRUNCATED) | [] | [] | 7 |
dtolnay/anyhow | 34 | dtolnay__anyhow-34 | [
"32"
] | 5e04e776efae33b311a850a0b6bae3104b90e1d4 | "diff --git a/src/error.rs b/src/error.rs\n--- a/src/error.rs\n+++ b/src/error.rs\n@@ -5,7 +5,7 @@ u(...TRUNCATED) | "diff --git a/tests/test_context.rs b/tests/test_context.rs\n--- a/tests/test_context.rs\n+++ b/test(...TRUNCATED) | "Figure out how context should interact with downcasting\nFor example if we have:\r\n\r\n```rust\r\n(...TRUNCATED) | For that matter, should `e.downcast_ref::<io::Error>()` succeed? | 2019-10-28T12:27:06 | 1.0 | 2737bbeb59f50651ff54ca3d879a3f5d659a98ab | [
"test_downcast_low",
"test_downcast_high",
"test_downcast_mid"
] | ["test_downcast_ref","test_inference","test_unsuccessful_downcast","test_convert","test_question_mar(...TRUNCATED) | [] | [] | 8 |
ratatui/ratatui | 1,226 | ratatui__ratatui-1226 | [
"1211"
] | 935a7187c273e0efc876d094d6247d50e28677a3 | "diff --git a/src/buffer/buffer.rs b/src/buffer/buffer.rs\n--- a/src/buffer/buffer.rs\n+++ b/src/buf(...TRUNCATED) | "diff --git a/src/buffer/buffer.rs b/src/buffer/buffer.rs\n--- a/src/buffer/buffer.rs\n+++ b/src/buf(...TRUNCATED) | "Visual glitch - Null character inside block wrapped component alters borders\n## Description\r\nG'd(...TRUNCATED) | "Thanks for reporting! oof, that must have been annoying to find. \nI think the solution for this is(...TRUNCATED) | 2024-07-12T20:26:33 | 0.27 | 935a7187c273e0efc876d094d6247d50e28677a3 | ["buffer::buffer::tests::control_sequence_rendered_partially","buffer::buffer::tests::control_sequen(...TRUNCATED) | ["backend::crossterm::tests::from_crossterm_color","backend::crossterm::tests::from_crossterm_conten(...TRUNCATED) | [
"backend::test::tests::buffer_view_with_overwrites"
] | [] | 9 |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 6