The contents of the editor window is the buffer . Technically speaking, when you edit a file, for example by File > Open... , its contents are copied into a buffer which is then displayed in the window. You actually edit the contents of the buffer, and never the file. When you save the buffer, for example by File > Save , its contents are copied back to the actual file on disk. Working in this way ensures that there is always a copy of the file on disk--if you make a mistake, or if your computer crashes, the last saved version of the file is always on disk, ensuring that you do not lose it completely.
Because of this distinction, the term buffer is used throughout, when referring to the text in the window.
An Editor can only have one editor window, although there can be many buffers open at once. This means that you can edit more than one file at once, although only one buffer can be displayed at a time in the window--any others remain hidden.
When you close a buffer, for example with the menu command
File > Close
or the key
Ctrl+X K
, the buffer is removed. This is different to the command
Window > Close Window
which closes the window and does not affect the buffer.
The diagram below shows the distinctions between the window, buffers and files on disk.
Figure 12.2 Distinctions between the window, buffers, and files on disk
The buffers view allows you to display a list of all the buffers that are currently open in the Editor, and gives you an easy way of navigating between them. Click on the Buffers tab to switch to this view, or press
Ctrl+X Ctrl+B
. The Editor appears as shown in Listing buffers in the Editor below.
Figure 12.3 Listing buffers in the Editor
The buffers view has two areas, described below.