diff --git a/lib/src/flow_editor_page.dart b/lib/src/flow_editor_page.dart index b46b4b2..ca9e865 100644 --- a/lib/src/flow_editor_page.dart +++ b/lib/src/flow_editor_page.dart @@ -127,7 +127,7 @@ class _FlowEditorPageState extends State { // captures whatever line-ending normalisation / fold- // marker insertion CodeController applied, so the dirty // check is comparing apples to apples. - _code.text = text; + _code.fullText = text; setState(() { _activeName = name; _baseline = _code.fullText; @@ -142,7 +142,7 @@ class _FlowEditorPageState extends State { if (keep == false || !mounted) return; } final text = await File(f.path).readAsString(); - _code.text = text; + _code.fullText = text; setState(() { _activeName = f.name; _baseline = _code.fullText; @@ -177,7 +177,10 @@ class _FlowEditorPageState extends State { setState(() => _saving = true); try { final f = File('${_defaultFlowsDir()}/$name.yaml'); - await f.writeAsString(_code.text, flush: true); + // Write fullText — `text` is post-fold visible-only, so + // saving it would lose any content the editor has hidden + // behind a collapsed fold. + await f.writeAsString(_code.fullText, flush: true); if (!mounted) return; setState(() { _baseline = _code.fullText; @@ -227,7 +230,7 @@ outputs: } await f.writeAsString(template, flush: true); if (!mounted) return; - _code.text = template; + _code.fullText = template; setState(() { _activeName = name; _baseline = _code.fullText; diff --git a/pubspec.yaml b/pubspec.yaml index 1e9dc3b..7fd16db 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: fai_studio_flow_editor description: Swappable inline YAML editor for F∆I Studio flows. -version: 0.1.1 +version: 0.1.2 publish_to: 'none' repository: https://git.flemming.ai/fai/studio-flow-editor