Editing In Place¶
Diffract lets you edit either side of a comparison directly in the panel without opening a separate editor. All edits are held in memory until you save.
Warning
The original file is never modified until you press Ctrl+S. All edits are held in an in-memory buffer.
Placing the Cursor¶
Click any non-empty cell in either panel. A blinking cyan caret appears at the click position. The cursor position is independent for each side - you can have a cursor in both panels at the same time.
Typing¶
Type any printable character to insert it at the cursor. The comparison re-runs after each keystroke and the panels update to reflect the new content. A small dot appears on the path bar to indicate that the side has unsaved changes.
Supported Keys¶
| Action | Key |
|---|---|
| Move to start / end of line | Home / End |
| Move by character | Arrow keys |
| Move by word | Ctrl+← / Ctrl+→ |
| Delete character to the left | Backspace |
| Delete character to the right | Delete |
| Merge lines (at line boundary) | Backspace or Delete |
| Split line | Enter |
| Extend selection | Shift+Arrow keys |
| Extend selection by click | Shift+Click |
| Select all (active side) | Ctrl+A |
| Copy | Ctrl+C |
| Cut | Ctrl+X |
Undo and Redo¶
Press Ctrl+Z to undo the last edit step. Press Ctrl+Shift+Z (or Ctrl+Y) to redo.
History rules:
- The undo stack holds up to 200 steps.
- Rapid keystrokes are debounced - a burst of typed characters counts as a single undo step.
- Structural edits (Enter, Backspace at line boundaries, cut, and hunk apply operations) each get their own undo step.
- Saving clears the undo history for that side.
Saving¶
Press Ctrl+S to write the virtual buffer to disk. The dot indicator on the path bar disappears and the comparison re-runs against the saved content.
Discarding Changes¶
Close the tab. If either side has unsaved changes, a confirmation dialog appears. Choose Discard to close without saving. Choose Cancel to return to the comparison.
External Changes¶
If a file is modified by another application while it is open in Diffract, a dialog appears asking what to do:
- Reload - discard any unsaved virtual edits and reload the file from disk. The comparison re-runs against the new content.
- Keep my changes - ignore the external change and continue with the current in-memory content.
- Discard my changes - discard your unsaved virtual edits but do not reload from disk.
The dialog appears at most once at a time per side. If both files are changed simultaneously, the dialog appears twice in sequence.