Program editing is considered in terms of a file-comparison model that formalizes the transformation of an imperfect version of a program text into an improved version by means of editing operations. With some enhancement, existing file-comparison algorithms can produce the information required for the model. These enhancements include the introduction of logical levels in files, selection of a corresponding element among alternatives, and the detection and analysis of similarity. An algorithm that incorporates these modifications is described. Illustrative of the use of the file-comparison model, a high-level editing sequence for a particular text editor and a particular editing task is automatically produced and is found to be comparable to typical user-produced editing sequences. Potential applications of the file-comparison model to the study of program editors are outlined.