Docs: what keeps a document switch from recording an unchanged edit (#12050)

The comment on worked_on_layer still said a document switch "still records".
commit_ending identifies that switch before worked_on_layer is read: it makes the
edit's own document active, calls commit_here with by_user false, and restores
the document that was active before, so ends_an_edit is false and nothing
records. That is the behaviour the family's another-document test pins.
Comment only, no behaviour change.
This commit is contained in:
hnoerenberg committed 2026-11-19 08:53:18 +01:00
1 parent 0ef7ab1450
commit bd3fce78c5
1 file changed
+4 -3
@@ -387,9 +387,10 @@ fn user_ends_the_edit(app: &PhotocraftApp) -> bool {
/// Is the session's layer still the one worked on? Selecting another layer or document commits the
/// session (#6483); #12050 does not measure that, so it records nothing. A background document's
/// edit is checked in its own document, where `commit_with` has just made it active - which is why
/// a document switch cannot be told from an in-place commit here, and still records (#12050 review
/// c4502824764).
/// edit is checked in its own document, where [`commit_ending`] has just made it active, so a
/// document switch cannot be told from an in-place commit here: [`commit_ending`] already found the
/// switch and passes `by_user` false, which is what keeps the unchanged edit from recording there
/// (#12050 review c4502824764).
fn worked_on_layer(app: &PhotocraftApp, ed: &TextEdit) -> bool {
app.session.active().is_some_and(|st| st.active_layer == Some(LayerId(ed.layer)))
}