Undo

The Undo command reverses the action of the last editing command in the current file. For example, if you type some new text and perform Undo, the text you typed is removed. Alternatively, if you delete a line and perform Undo, the line reappears.

In effect, as you edit, Source Insight makes a list of the changes you've made to each file. The Undo command backs up through that list and the Redo command advances through the list.

Undo information is saved for each open file independently.

Undoing Cursor Movement

The Undo command does not undo cursor movements, as with some other editors. In Source Insight, the best way to "back up" through the history of cursor movements is to use the Go Back command (and con­versely, the Go Forward command).

Undoing All Changes

You can use the Undo command several times in a row to undo several changes. In addition, you can use the Undo All command to undo all changes made to the current file since the last time it was opened.

The Undo History

The undo history is maintained after you save a file, as long as the file is open. Undo history is lost when the file is closed, or if you use the Checkpoint command to perform a final save. You can control whether undo is normally available after saving by using the Options > Preferences: Files dialog box.

It is possible to save a file, and then undo the few last edits. After that, the file saved on disk represents a state that has more edits than the current file buffer. This can become confusing. To help, Source Insight dis­plays the file name with an asterisk whenever the loaded buffer differs from the file saved on disk. If you try to undo to a point before the file was saved, you will prompted to confirm you want to do that.

Restoring Lines

An alternative to Undo is the Restore Lines command. This command restores the selected lines to their orig­inal contents when the file was first opened. Furthermore, the Restore Lines command can be undone with the Undo command. Mixing both Undo and Restore Lines can be very useful.