diff --git a/src/search/display/glob_result.rs b/src/search/display/glob_result.rs index d55e088..bca9636 100644 --- a/src/search/display/glob_result.rs +++ b/src/search/display/glob_result.rs @@ -49,7 +49,7 @@ pub(super) fn format_glob_result( label: &str, ) -> Result { let header = format!( - "# {label}: \"{}\" in {} — {} of {} files (offset {})", + "# {label}: \"{}\" in {} — {} of {} files (offset {}, sizes ~= tokens)", result.pattern, crate::format::display_path(scope), result.files.len(), diff --git a/src/search/glob.rs b/src/search/glob.rs index 1d78ba9..4082caf 100644 --- a/src/search/glob.rs +++ b/src/search/glob.rs @@ -187,18 +187,18 @@ pub fn search_with_scope_glob( }) } -/// Quick preview: token estimate plus a one-line summary for code/text files. -/// For code files, the summary is the first non-empty doc/comment or code line -/// (truncated to ~80 chars). For other files, only the token estimate is shown. +/// Quick preview: approximate token count plus a one-line summary for code/text files. +/// The unit is declared once in the result header, so per-file rows keep only the +/// compact `~N` size marker. fn file_preview(path: &Path) -> Option { let meta = std::fs::metadata(path).ok()?; let tokens = estimate_tokens(meta.len()); let summary = first_meaningful_line(path).unwrap_or_default(); if summary.is_empty() { - Some(format!("~{tokens} tokens")) + Some(format!("~{tokens}")) } else { - Some(format!("~{tokens} tokens · {summary}")) + Some(format!("~{tokens} · {summary}")) } } diff --git a/tests/files_and_symbol_glob.rs b/tests/files_and_symbol_glob.rs index e5ae3b6..75bb002 100644 --- a/tests/files_and_symbol_glob.rs +++ b/tests/files_and_symbol_glob.rs @@ -203,6 +203,10 @@ fn files_action_lists_file_globs() { &dir.join("controllers/front/ProductController.php"), "