1
1
mirror of https://github.com/wez/wezterm.git synced 2024-10-27 16:19:25 +03:00

quick select: make user patterns take precedence

I think the future for this is to extend the Pattern type to accept
a list of regexes and use a RegexSet to unambiguously handle multiple
patterns with captures.

That might help a little with https://github.com/wez/wezterm/issues/3247
but the stated use in that issue may not even work with the rust
regex crate.

For now we do the simple thing and match the user's patterns
first.

refs: https://github.com/wez/wezterm/issues/3456
This commit is contained in:
Wez Furlong 2023-04-06 15:50:24 -07:00
parent 6ab01ce619
commit 760864b6b2
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
2 changed files with 10 additions and 7 deletions

View File

@ -99,6 +99,8 @@ As features stabilize some brief notes about them will accumulate here.
the local machine or vice versa. #3442
* `wezterm.config_builder` now works with `table.insert(config.keys, {..})`
* mux: `wezterm cli activate-pane-direction` inconsistent behavior with remote mux. #3387 #3448
* [quick_select_patterns](config/lua/config/quick_select_patterns.md) didn't
take precedence over built-in rules. #3456
### 20230326-111934-3666303c

View File

@ -204,6 +204,14 @@ impl QuickSelectOverlay {
have_patterns = true;
}
} else {
// User-provided patterns take precedence over built-ins
for p in &config.quick_select_patterns {
if have_patterns {
pattern.push('|');
}
pattern.push_str(p);
have_patterns = true;
}
if !config.disable_default_quick_select_patterns {
for p in &PATTERNS {
if have_patterns {
@ -213,13 +221,6 @@ impl QuickSelectOverlay {
have_patterns = true;
}
}
for p in &config.quick_select_patterns {
if have_patterns {
pattern.push('|');
}
pattern.push_str(p);
have_patterns = true;
}
}
pattern.push(')');