The export moment's file name is one line, ellipsized
Browse files at this commit388faa687ffebab4e908adee3d144cfd81f17bbaParent: 166e4a1- fix
- the export moment's file name is one line, ellipsized
2 changed files +21 -2
crates/app/src/tests/cards.rsmodified+13 -0
| @@ -985,6 +985,19 @@ fn the_export_moment_is_three_rows_one_chip_and_no_list() { | |||
| 985 | for gone in ["Advanced", "preset", "Quality", "Subtitles", "GPU: ", "Built in"] { | 985 | for gone in ["Advanced", "preset", "Quality", "Subtitles", "GPU: ", "Built in"] { |
| 986 | assert!(!body.contains(gone), "the old card's {gone} is still here"); | 986 | assert!(!body.contains(gone), "the old card's {gone} is still here"); |
| 987 | } | 987 | } |
| 988 | + // Row 1 is one line at every width: the stem ellipsizes and the | ||
| 989 | + // extension rides beside it (at 1280 the nested block child wrapped | ||
| 990 | + // `.mp4` onto a second line and the moment read as four rows). | ||
| 991 | + let name = &body[body.find("\"destination\"").expect("the file row")..]; | ||
| 992 | + let name = &name[..name.find("\"budget\"").unwrap_or(name.len())]; | ||
| 993 | + assert!( | ||
| 994 | + name.contains(".truncate()"), | ||
| 995 | + "the file name wraps again -- it must ellipsize on one line" | ||
| 996 | + ); | ||
| 997 | + assert!( | ||
| 998 | + name.contains(".flex_none()") && name.contains("ext.to_string()"), | ||
| 999 | + "the extension must sit beside the stem, not under it" | ||
| 1000 | + ); | ||
| 988 | // Its three rows, each reachable by pointer as well as by chord. | 1001 | // Its three rows, each reachable by pointer as well as by chord. |
| 989 | for id in ["destination", "budget", "budget-track", "export-confirm"] { | 1002 | for id in ["destination", "budget", "budget-track", "export-confirm"] { |
| 990 | assert!(body.contains(&format!("\"{id}\"")), "{id} is on no row"); | 1003 | assert!(body.contains(&format!("\"{id}\"")), "{id} is on no row"); |
crates/app/src/ui/cards.rsmodified+8 -2
| @@ -359,15 +359,21 @@ impl Player { | |||
| 359 | .cursor_pointer() | 359 | .cursor_pointer() |
| 360 | .on_click(cx.listener(|this, _: &ClickEvent, _, cx| this.pick_destination(cx))) | 360 | .on_click(cx.listener(|this, _: &ClickEvent, _, cx| this.pick_destination(cx))) |
| 361 | .child( | 361 | .child( |
| 362 | + // One line, always: the stem gives way with an ellipsis and | ||
| 363 | + // the extension rides beside it. A nested block child would | ||
| 364 | + // wrap it under the name instead, which is what the narrow | ||
| 365 | + // window showed. | ||
| 362 | div() | 366 | div() |
| 363 | .flex_1() | 367 | .flex_1() |
| 364 | .min_w(px(0.)) | 368 | .min_w(px(0.)) |
| 365 | - .truncate() | 369 | + .flex() |
| 370 | + .items_baseline() | ||
| 366 | .type_style(type_scale::mono(18., gpui::FontWeight::BOLD)) | 371 | .type_style(type_scale::mono(18., gpui::FontWeight::BOLD)) |
| 367 | .text_color(rgb(INK1())) | 372 | .text_color(rgb(INK1())) |
| 368 | - .child(stem.to_string()) | 373 | + .child(div().min_w(px(0.)).truncate().child(stem.to_string())) |
| 369 | .child( | 374 | .child( |
| 370 | div() | 375 | div() |
| 376 | + .flex_none() | ||
| 371 | .text_color(rgb(INK2())) | 377 | .text_color(rgb(INK2())) |
| 372 | .child(ext.to_string()), | 378 | .child(ext.to_string()), |
| 373 | ), | 379 | ), |