ui: name a sample's document after it until saved (#334); "Solve cancelled"

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-15 08:55:25 -04:00
1 parent 8819ff787c
commit b65f1696b2
3 files changed
+12 -3

No files matched your search

+1
View File
@@ -106,6 +106,7 @@ fn open_sample(s: &mut Session, p: &Value) -> Result<Value> {
// A sample just opened has nothing to save: it opens again the same way.
opened.saved_revision = Some(opened.revision);
opened.saved_view = opened.view.clone();
opened.sample = Some(sample.label);
s.replace_with(opened);
let mut reply = summary(s, &[]);
reply["sample"] = json!(sample.name);
+3
View File
@@ -224,6 +224,9 @@ pub struct Session {
pub journal: Vec<(String, Value)>,
/// The `.fieldcraft` file the session was opened from or last saved to.
pub path: Option<String>,
/// The sample the session was opened as (`file.sample`), by its label; the document is named
/// after it until it is saved under a name of its own.
pub sample: Option<&'static str>,
history: History,
/// Identifies the current state: it changes with every edit, undo and redo, and comes back
/// when an undo returns to an earlier state.