diff --git a/crates/iz-web/src/detail.rs b/crates/iz-web/src/detail.rs index 4fcf789..330c691 100644 --- a/crates/iz-web/src/detail.rs +++ b/crates/iz-web/src/detail.rs @@ -2704,15 +2704,27 @@ async fn sheet_view<'a>( // window's own edges in the same vocabulary the grid labels its gutters // with, counted against the whole sheet where the file's own size can be // trusted and left uncounted where it cannot. - let row_range = match sheet.total_rows { - Some(total) => format!("{}–{} / {total}", sheet.first_row + 1, sheet.last_row()), - None => format!("{}–{}", sheet.first_row + 1, sheet.last_row()), + // A window paged past the sheet's own cells has no edges to name: + // first_row would count up past last_row. Say so instead of printing an + // inverted range. + let window_empty = sheet.rows.is_empty() && (sheet.first_row > 0 || sheet.first_column > 0); + let row_range = if window_empty { + t(lang, Key::SheetWindowEmpty).to_string() + } else { + match sheet.total_rows { + Some(total) => format!("{}–{} / {total}", sheet.first_row + 1, sheet.last_row()), + None => format!("{}–{}", sheet.first_row + 1, sheet.last_row()), + } }; let first_letter = column_name(sheet.first_column); let last_letter = column_name(sheet.last_column().saturating_sub(1)); - let column_range = match sheet.total_columns { - Some(total) => format!("{first_letter}–{last_letter} / {total}"), - None => format!("{first_letter}–{last_letter}"), + let column_range = if window_empty { + String::new() + } else { + match sheet.total_columns { + Some(total) => format!("{first_letter}–{last_letter} / {total}"), + None => format!("{first_letter}–{last_letter}"), + } }; Ok(view! { cx => diff --git a/crates/iz-web/src/i18n.rs b/crates/iz-web/src/i18n.rs index dbb8693..3a88c42 100644 --- a/crates/iz-web/src/i18n.rs +++ b/crates/iz-web/src/i18n.rs @@ -68,6 +68,7 @@ pub enum Key { CloseTheFile, Present, ThisFileWillNotOpen, + SheetWindowEmpty, Previous, Next, Esc, @@ -464,6 +465,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str { (CloseTheFile, Tr) => "Dosyayı kapat", (ThisFileWillNotOpen, En) => "This file will not open.", (ThisFileWillNotOpen, Tr) => "Bu dosya açılmıyor.", + (SheetWindowEmpty, En) => "This window is past the sheet's cells — step back.", + (SheetWindowEmpty, Tr) => "Bu pencere sayfanın hücrelerinin ötesinde — geri dön.", (Previous, En) => "Previous", (Previous, Tr) => "Önceki", (Next, En) => "Next",