T21a round 3 fix, after the cap

- TextInput records the selection each edit replaces, where every edit passes;
  the block editor's undo goes back to it, for typing, delete, cut and paste
- TextInput's layout geometry moves to forms/text/geometry.rs
- Reviews: T21a done, fixed after the cap, no fourth review
This commit is contained in:
ZacharyZhang-NY committed 2026-09-26 04:03:43 -04:00
1 parent 187f54253e
commit 14a8990793
7 files changed
+109 -74

No files matched your search

+3 -1
View File
@@ -76,7 +76,7 @@ pub struct BlockEditor {
current: Snapshot,
/// The field that last held focus, as block and field.
caret: Option<(u64, usize)>,
/// The selection a key went down on, before its field changed.
/// The selection the last edit in a field replaced.
typed_from: Option<(u64, usize, std::ops::Range<usize>)>,
pub(crate) people: Vec<SharedString>,
pub(crate) diagram: Option<RenderDiagram>,
@@ -288,6 +288,8 @@ impl BlockEditor {
.insert(name.clone(), text);
}
}
let at = self.blocks[ix].fields.iter().position(|each| each == field);
self.typed_from = at.map(|at| (key, at, field.read(cx).edited_from()));
self.settle(true, cx);
}
InputEvent::Focus => {