F1: cosmetics: regex error reason, one date format, Close Tab
Some checks are pending
ci / ci (macos-15) (push) Waiting to run
ci / ci (ubuntu-24.04) (push) Waiting to run
ci / ci (windows-2025) (push) Waiting to run

- Find shows a bad regex as "invalid pattern: unclosed group": the search
  crate keeps only the parser's reason, the UI drops the invalid-params
  prefix (userMessage).
- Dates read YYYY-MM-DD / YYYY-MM-DD HH:mm in local time everywhere
  (i18n formatDate/formatDateTime): Log, stash list, blame, recovery.
- buffer.close is "Close Tab" in the palette as in the menu; an engine test
  keeps palette labels starting with their menu item's wording.
- Docs: architecture, install (Jump List), localization parity, checklist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-02 19:31:43 +01:00
parent 1b6bd1f870
commit 33a7185d75
18 changed files with 147 additions and 52 deletions

View file

@ -44,7 +44,7 @@ impl Search {
.dfa_size_limit(REGEX_SIZE_LIMIT)
.nest_limit(REGEX_NEST_LIMIT)
.build(&query.pattern)
.map_err(|e| SearchError::InvalidPattern(e.to_string()))?;
.map_err(|e| SearchError::InvalidPattern(pattern_error(&e.to_string())))?;
Ok(Self {
matcher,
filter: PathFilter::new(&query.include, &query.exclude)?,
@ -53,6 +53,20 @@ impl Search {
}
}
/// The reason in a regex error for a person: the regex parser's report
/// spans several lines (the pattern as the matcher wrapped it, a caret, then
/// `error: <reason>`), so only the reason is kept; other errors keep their
/// text with line breaks and runs of spaces folded into one space.
pub(crate) fn pattern_error(text: &str) -> String {
if let Some(reason) = text
.lines()
.find_map(|line| line.trim().strip_prefix("error: "))
{
return reason.trim().to_string();
}
text.split_whitespace().collect::<Vec<_>>().join(" ")
}
/// Include and exclude globs, split by whether they match a name or a path.
#[derive(Debug, Clone)]
pub(crate) struct PathFilter {

View file

@ -81,10 +81,18 @@ fn regex_and_invalid_input() {
assert_eq!(files[0].matches[1].length, 5);
q.pattern = "(".into();
assert!(matches!(
Search::new(&q),
Err(SearchError::InvalidPattern(_))
));
assert_eq!(
Search::new(&q).unwrap_err().to_string(),
"invalid pattern: unclosed group"
);
q.pattern = "a{".into();
let message = Search::new(&q).unwrap_err().to_string();
assert!(
message.starts_with("invalid pattern: ")
&& !message.contains('\n')
&& !message.contains("(?:"),
"{message}"
);
q.pattern = String::new();
assert_eq!(Search::new(&q).unwrap_err(), SearchError::EmptyPattern);
let mut q = Query::literal("x");