MSR editor ========== The **MSR Editor** tab displays the complete MSR file that muSRFlow prepares. It is a real editor, not just a preview: you can edit the text by hand, and the edited document becomes the source of truth for the next Fit or Plot. .. figure:: images/msr-editor-tab.png :alt: MSR Editor showing a generated unfitted MSR with highlighted block keywords and comments, the GUI to MSR button, and the ownership lock. :width: 100% A document generated with **GUI -> MSR**, before any fit. Syntax colours separate keywords and comments. The open padlock shows that the GUI still owns this document; editing it by hand changes that state. Ownership: GUI or editor ------------------------ Two actors can own the document: * the **GUI**, which regenerates the MSR from the current tab settings; and * the **editor**, once you edit the text by hand. The lock icon in the editor toolbar shows which one owns the document. An open padlock means the GUI owns it and the next GUI generation or fit can replace the text; a closed padlock means the editor owns it and Fit and Plot use the text as-is. Workflow -------- **GUI to MSR** (the ``GUI -> MSR`` button) Replaces the visible document with one generated fresh from the analysis settings. The GUI is the source of the text. **Edit by hand** Entering text hands ownership to the editor: the lock icon becomes a closed padlock. While locked, **Fit** and **Plot** use the document as-is and GUI changes do not silently replace it. Any attempt that would overwrite the edited text asks for confirmation first. **MSR to GUI** (the ``MSR -> GUI`` button) Copies the recognised settings of the current document back into the GUI fields (run list, fit range, model, parameters, and constraints). This does not surrender editor ownership; the editor keeps the document until you unlock it. **Unlock** (click the closed padlock) Returns control of the document to the GUI, so the next GUI generation or fit may replace it. File handling ------------- On the desktop (Electron), the **File** menu opens and saves MSR files directly. The **Save** button in the editor toolbar writes the current document to disk. On the web, saving is handled through the server's result artifacts. The editor also shows which source document it currently displays. For a multiple-run fit it can expose the generated document and the template it was built from; the active tab (**MSR** or **Template**) selects which one is shown. For a complete example using real fitted LEM data and application screenshots, see :doc:`lem2025-singlehist-example`.