iz-web: sheet pager shows a translated note past the last cell
Browse files at this commita27a81d3393fc33b53dfcdf976ba281240cbeadcParent: db99ba52 changed files +21 -6
- crates/iz-web/src/detail.rs +18 -6
- crates/iz-web/src/i18n.rs +3 -0
crates/iz-web/src/detail.rsmodified+18 -6
| @@ -2704,15 +2704,27 @@ async fn sheet_view<'a>( | |||
| 2704 | // window's own edges in the same vocabulary the grid labels its gutters | 2704 | // window's own edges in the same vocabulary the grid labels its gutters |
| 2705 | // with, counted against the whole sheet where the file's own size can be | 2705 | // with, counted against the whole sheet where the file's own size can be |
| 2706 | // trusted and left uncounted where it cannot. | 2706 | // trusted and left uncounted where it cannot. |
| 2707 | - let row_range = match sheet.total_rows { | 2707 | + // A window paged past the sheet's own cells has no edges to name: |
| 2708 | - Some(total) => format!("{}–{} / {total}", sheet.first_row + 1, sheet.last_row()), | 2708 | + // first_row would count up past last_row. Say so instead of printing an |
| 2709 | - None => format!("{}–{}", sheet.first_row + 1, sheet.last_row()), | 2709 | + // inverted range. |
| 2710 | + let window_empty = sheet.rows.is_empty() && (sheet.first_row > 0 || sheet.first_column > 0); | ||
| 2711 | + let row_range = if window_empty { | ||
| 2712 | + t(lang, Key::SheetWindowEmpty).to_string() | ||
| 2713 | + } else { | ||
| 2714 | + match sheet.total_rows { | ||
| 2715 | + Some(total) => format!("{}–{} / {total}", sheet.first_row + 1, sheet.last_row()), | ||
| 2716 | + None => format!("{}–{}", sheet.first_row + 1, sheet.last_row()), | ||
| 2717 | + } | ||
| 2710 | }; | 2718 | }; |
| 2711 | let first_letter = column_name(sheet.first_column); | 2719 | let first_letter = column_name(sheet.first_column); |
| 2712 | let last_letter = column_name(sheet.last_column().saturating_sub(1)); | 2720 | let last_letter = column_name(sheet.last_column().saturating_sub(1)); |
| 2713 | - let column_range = match sheet.total_columns { | 2721 | + let column_range = if window_empty { |
| 2714 | - Some(total) => format!("{first_letter}–{last_letter} / {total}"), | 2722 | + String::new() |
| 2715 | - None => format!("{first_letter}–{last_letter}"), | 2723 | + } else { |
| 2724 | + match sheet.total_columns { | ||
| 2725 | + Some(total) => format!("{first_letter}–{last_letter} / {total}"), | ||
| 2726 | + None => format!("{first_letter}–{last_letter}"), | ||
| 2727 | + } | ||
| 2716 | }; | 2728 | }; |
| 2717 | Ok(view! { | 2729 | Ok(view! { |
| 2718 | cx => | 2730 | cx => |
crates/iz-web/src/i18n.rsmodified+3 -0
| @@ -68,6 +68,7 @@ pub enum Key { | |||
| 68 | CloseTheFile, | 68 | CloseTheFile, |
| 69 | Present, | 69 | Present, |
| 70 | ThisFileWillNotOpen, | 70 | ThisFileWillNotOpen, |
| 71 | + SheetWindowEmpty, | ||
| 71 | Previous, | 72 | Previous, |
| 72 | Next, | 73 | Next, |
| 73 | Esc, | 74 | Esc, |
| @@ -464,6 +465,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str { | |||
| 464 | (CloseTheFile, Tr) => "Dosyayı kapat", | 465 | (CloseTheFile, Tr) => "Dosyayı kapat", |
| 465 | (ThisFileWillNotOpen, En) => "This file will not open.", | 466 | (ThisFileWillNotOpen, En) => "This file will not open.", |
| 466 | (ThisFileWillNotOpen, Tr) => "Bu dosya açılmıyor.", | 467 | (ThisFileWillNotOpen, Tr) => "Bu dosya açılmıyor.", |
| 468 | + (SheetWindowEmpty, En) => "This window is past the sheet's cells — step back.", | ||
| 469 | + (SheetWindowEmpty, Tr) => "Bu pencere sayfanın hücrelerinin ötesinde — geri dön.", | ||
| 467 | (Previous, En) => "Previous", | 470 | (Previous, En) => "Previous", |
| 468 | (Previous, Tr) => "Önceki", | 471 | (Previous, Tr) => "Önceki", |
| 469 | (Next, En) => "Next", | 472 | (Next, En) => "Next", |