mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-26 19:56:48 -06:00
Review fix for #2473: a repeated sheet name matches in any case
Sheet1!A1:SHEET1!B2 is a range whose second end repeats the sheet, as Sheet1!A1:Sheet1!B2 is: the check uses same_name, Excel's case-insensitive name comparison. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0665476b35
commit
4eb2fb5c8e
@@ -346,7 +346,7 @@ pub fn tokenize_locale(src: &str, locale: crate::FormulaLocale) -> Result<Vec<To
|
||||
// `Sheet1!A1:Sheet1!B2` is a range whose second end repeats the sheet, not a span.
|
||||
let repeats_sheet = is_range_end(&w)
|
||||
&& matches!(out.last(), Some(Token { tok: Tok::Sheet(p, None), .. })
|
||||
if chars.get(j + 1..k).is_some_and(|s| s.iter().map(|c| c.1).eq(p.chars())));
|
||||
if chars.get(j + 1..k).is_some_and(|s| crate::same_name(&s.iter().map(|c| c.1).collect::<String>(), p)));
|
||||
k > j + 1 && ch(k) == Some('!') && !repeats_sheet
|
||||
} {
|
||||
let mut k = j + 1;
|
||||
|
||||
@@ -10,6 +10,8 @@ fn range_end_repeating_sheet_name_round_trips() {
|
||||
assert_eq!(rt("'a'!A1:'a'!B2"), "a!A1:a!B2");
|
||||
assert_eq!(rt("Sheet1!A1:Sheet1!B2"), "Sheet1!A1:Sheet1!B2");
|
||||
assert_eq!(rt("SUM(a!A1:a!B2)"), "SUM(a!A1:a!B2)");
|
||||
// Sheet names match without regard to case, as Excel's do.
|
||||
assert_eq!(rt("Sheet1!A1:SHEET1!B2"), "Sheet1!A1:SHEET1!B2");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user