ChangesList: a long file name ends in an ellipsis before the row's buttons
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3eb4d346fe
commit
bd014707fd
3 files changed
+50
-2
No files matched your search
+10
-2
@@ -199,12 +199,16 @@ impl ChangesList {
|
|||||||
.gap_2()
|
.gap_2()
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.flex_none()
|
.min_w_0()
|
||||||
.text_color(colors.fg)
|
.text_color(colors.fg)
|
||||||
|
.debug_selector({
|
||||||
|
let path = file.path.clone();
|
||||||
|
move || format!("change-name-{path}")
|
||||||
|
})
|
||||||
.when(file.status == GitStatus::Deleted, |name| {
|
.when(file.status == GitStatus::Deleted, |name| {
|
||||||
name.line_through()
|
name.line_through()
|
||||||
})
|
})
|
||||||
.child(name),
|
.child(Ellipsis::new(name)),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
@@ -218,6 +222,10 @@ impl ChangesList {
|
|||||||
div()
|
div()
|
||||||
.flex_none()
|
.flex_none()
|
||||||
.flex()
|
.flex()
|
||||||
|
.debug_selector({
|
||||||
|
let path = file.path.clone();
|
||||||
|
move || format!("change-actions-{path}")
|
||||||
|
})
|
||||||
.child(action(
|
.child(action(
|
||||||
"open",
|
"open",
|
||||||
IconName::FileText,
|
IconName::FileText,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use gpui::{
|
|||||||
|
|
||||||
use super::DiffViewer;
|
use super::DiffViewer;
|
||||||
|
|
||||||
|
mod narrow;
|
||||||
mod picking;
|
mod picking;
|
||||||
use crate::{forms, primitives::FocusNext, theme::Theme};
|
use crate::{forms, primitives::FocusNext, theme::Theme};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
use gpui::{
|
||||||
|
Context, IntoElement, ParentElement, Render, TestAppContext, Window, div, prelude::*, px,
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::{lists::GitStatus, theme::Theme};
|
||||||
|
|
||||||
|
const LONG: &str = "developerID_application_certificate_for_signing.cer";
|
||||||
|
const NAME: &str = "change-name-developerID_application_certificate_for_signing.cer";
|
||||||
|
const ACTIONS: &str = "change-actions-developerID_application_certificate_for_signing.cer";
|
||||||
|
|
||||||
|
struct Narrow;
|
||||||
|
|
||||||
|
impl Render for Narrow {
|
||||||
|
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
|
||||||
|
let file = super::super::Changed {
|
||||||
|
path: LONG.into(),
|
||||||
|
status: GitStatus::Untracked,
|
||||||
|
lines: None,
|
||||||
|
};
|
||||||
|
div()
|
||||||
|
.w(px(260.0))
|
||||||
|
.child(super::super::ChangesList::new("narrow", [], []).untracked([file]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A long name gives way before the row's buttons; it never runs under them.
|
||||||
|
#[gpui::test]
|
||||||
|
fn a_long_name_ends_before_the_buttons(cx: &mut TestAppContext) {
|
||||||
|
cx.update(Theme::init);
|
||||||
|
let (_, cx) = cx.add_window_view(|_, _| Narrow);
|
||||||
|
cx.run_until_parked();
|
||||||
|
let name = cx.debug_bounds(NAME).expect("the name");
|
||||||
|
let actions = cx.debug_bounds(ACTIONS).expect("the buttons");
|
||||||
|
assert!(
|
||||||
|
name.right() <= actions.left(),
|
||||||
|
"{name:?} runs into {actions:?}"
|
||||||
|
);
|
||||||
|
assert!(actions.right() <= px(260.0), "{actions:?}");
|
||||||
|
}
|
||||||
Reference in new issue
Block a user