DB & Dev Tools · Data formats: YAML lists at their key's indent, XML entities
YAML reads a list written at its key's own indent, as manifests do, and a list at a map's indent ends at the next key. A `#` inside a quoted scalar is no comment. XML reads entity references in text and attributes, failing on one it does not know, and a text's path counts text nodes from one. A tree's note takes at most half its row, cut with an ellipsis, so a long value or attribute leaves the key its name. Format and Minify fail loud if pressed while the JSON does not read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1c01adc4d6
commit
a0984e80a3
8 files changed
+204
-40
No files matched your search
@@ -3,7 +3,7 @@ use std::{ops::Range, rc::Rc};
|
||||
use gpui::{
|
||||
AnyElement, App, DragMoveEvent, ElementId, Entity, EntityId, FocusHandle, InteractiveElement,
|
||||
IntoElement, MouseButton, ParentElement, SharedString, StatefulInteractiveElement, Styled,
|
||||
Window, div, prelude::*,
|
||||
Window, div, prelude::*, relative,
|
||||
};
|
||||
|
||||
use super::{
|
||||
@@ -210,10 +210,12 @@ fn row(rows: &Rows, ix: usize, window: &mut Window, cx: &mut App) -> AnyElement
|
||||
.child(body)
|
||||
.children(note.map(|note| {
|
||||
div()
|
||||
.debug_selector(|| "tree-note".into())
|
||||
.flex_none()
|
||||
.max_w(relative(0.5))
|
||||
.text_size(theme.text_size(TextSize::Xs))
|
||||
.text_color(ink.unwrap_or(colors.fg_subtle))
|
||||
.child(note)
|
||||
.child(Ellipsis::new(note))
|
||||
}))
|
||||
.children(landing.filter(|at| *at != DropAt::Inside).map(line))
|
||||
.on_click(move |event, window, cx| {
|
||||
|
||||
+16
-1
@@ -34,7 +34,8 @@ impl Render for Explorer {
|
||||
TreeNode::new("ui", "ui").child(TreeNode::new("button", "button.rs")),
|
||||
]),
|
||||
docs,
|
||||
TreeNode::new("readme", "README.md"),
|
||||
TreeNode::new("readme", "README.md")
|
||||
.note("a note long enough to take the whole row and more"),
|
||||
];
|
||||
let (select, check, load, rename, moved) = (
|
||||
view.clone(),
|
||||
@@ -95,6 +96,20 @@ fn read<T>(view: &Entity<Explorer>, cx: &mut VisualTestContext, f: impl Fn(&Expl
|
||||
view.read_with(cx, |explorer, _| f(explorer))
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn a_long_note_leaves_the_label_half_the_row(cx: &mut TestAppContext) {
|
||||
let (_, cx) = explorer(false, cx);
|
||||
let note = cx.debug_bounds("tree-note").expect("the readme's note");
|
||||
assert!(
|
||||
note.size.width <= px(150.0),
|
||||
"the note takes at most half the row: {note:?}"
|
||||
);
|
||||
assert!(
|
||||
note.size.width > px(100.0),
|
||||
"the note keeps its half: {note:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn keys_walk_open_climb_and_close(cx: &mut TestAppContext) {
|
||||
let (view, cx) = explorer(false, cx);
|
||||
|
||||
Reference in new issue
Block a user