<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=US-ASCII">
<meta name="author" content="mailto:webmaster@zap.tartarus.org">
<meta name="description" content="Zap is a configurable programmers' editor for Acorn RISC OS">
<title>Simple operation</title>
</head>
<body background='/img/background.png' text="#000000" bgcolor="#DCDCDC" link="#20209F" vlink="#008000" alink="#FF2020">
<p align='center'><a href="Chapter2">Previous</a> | <a href="Contents">Contents</a> | <a href="IndexPage">Index</a> | <a href="Chapter4">Next</a></p>

<ul>
<li><a href="#C3">Chapter 3: Simple operation</a>
<ul>
<li><a href="#S3.1">3.1 Loading and creating files</a></li>
<li><a href="#S3.2">3.2 A Zap editing window</a>
<ul>
<li><a href="#S3.2.1">3.2.1 Titlebar options characters</a></li>
</ul></li>
<li><a href="#S3.3">3.3 Basic editing</a>
<ul>
<li><a href="#S3.3.1">3.3.1 Zap's cursors</a></li>
</ul></li>
<li><a href="#S3.4">3.4 Keyboard shortcuts</a>
<ul>
<li><a href="#S3.4.1">3.4.1 Moving around your file</a></li>
<li><a href="#S3.4.2">3.4.2 Other useful keystrokes</a></li>
<li><a href="#S3.4.3">3.4.3 Keystrokes in dialogue boxes</a></li>
<li><a href="#S3.4.4">3.4.4 Zap's minibuffer</a></li>
</ul></li>
<li><a href="#S3.5">3.5 Further editing</a>
<ul>
<li><a href="#S3.5.1">3.5.1 Undo and redo: recovering from mistakes</a></li>
<li><a href="#S3.5.2">3.5.2 Quoting characters</a></li>
<li><a href="#S3.5.3">3.5.3 Inserting files</a></li>
</ul></li>
<li><a href="#S3.6">3.6 Saving and closing files</a>
<ul>
<li><a href="#S3.6.1">3.6.1 Automatic backups</a></li>
</ul></li>
</ul></li>
</ul>
<h1><a name="C3"></a>Chapter 3: Simple operation</h1>
<h2><a name="S3.1"></a>3.1 Loading and creating files</h2>
<p>
Once Zap has loaded onto the iconbar, you can create a new file by:
</p>
<ul><li>
clicking <code>Select</code>, which will create a new text file.
</li>
<li>
clicking <code>Adjust</code>, which will create a new BASIC file.
</li>
<li>
clicking <code>Menu</code>, opening the <code>Create-&gt;New file</code> submenu, and selecting the type of file you want.
</li>
</ul>
<p>
Alternatively, you can load an existing file into Zap:
</p>
<ul><li>
if it is a text file, double click on it (you will find that some other files will load straight into Zap in this way - see <a href="Chapter12#S12.3.2">section 12.3.2</a> for more details).
</li>
<li>
if the file is typed, hold down the left <code>Shift</code> key and double click on it.
</li>
<li>
(for all files) drag it to Zap's icon on the iconbar.
</li>
</ul>
<p>
If you load a file into Zap, it will check to see if it is a <a name="i0"></a>DOS file (line ends are <code>CRLF</code>) or <a name="i1"></a>Spool file (line ends are <code>LFCR</code>) as it does. If it is in either format, it doesn't just load the file, but converts it to use a lone <code>LF</code> for line ends first to make editing easier. It will then automatically convert back when you save - see <a href="Chapter6#S6.9">section 6.9</a> for more details.
</p>
<p>
When you load a file into Zap, or create a new one, it works out the best <em>mode</em> to put it in. For the moment, don't worry about this - if you're new to Zap, just create a text file by clicking Select on Zap's icon, and we'll cover modes later, in <a href="Chapter10#C10">chapter 10</a>. However it is worth noting that you can override what Zap thinks is the best mode by holding down <code>Control</code> - this will drop the file into whatever's set as the '<a name="i2"></a>default mode' - typically either Text or Byte. See the note at the end of <a href="Chapter12#S12.2.1">section 12.2.1</a> for how to configure this.
</p>
<p>
If the file is already loaded into Zap and you have altered it, Zap will ask you whether you want to <code>Cancel</code> (don't load the file), <code>Edit</code> (load the file, but keep the altered file loaded as well), or <code>Overwrite</code> (close the altered file without giving you a chance to save it, and then opening the one on disc). The dialogue box Zap uses to ask you this also has a <code>To Front</code> button, which will bring all the windows on the altered file to the front of the window stack, so you can decide what you want to do. Several of Zap's dialogue boxes in similar situations have this button.
</p>
<p>
Zap can also grab the memory of running applications, the contents of dynamic areas, sectors from discs, and the code or workspace of a relocatable module; see <a href="Chapter10#S10.1.3">section 10.1.3</a> for more information.
</p>
<h2><a name="S3.2"></a>3.2 A Zap editing window</h2>
<p>
A Zap editing window is just a normal <a name="i3"></a>RISC OS window, with one slight exception (see <a href="#S3.4.4">section 3.4.4</a>). As you'd expect, clicking <code>Menu</code> on a Zap editing window will bring up a menu which has options to let you save the file you are working on, and a range of other useful operations.
</p>
<p>
In common with many applications, Zap puts the filename in the window's title bar, but it also puts some other information there too. In any mode, the window title is of the form:
</p>
<pre><code>&lt;filename&gt; [*] ([mode name] [options]) [view number/number of views]
</code></pre>
<p>
The title is centered unless the window is small, when it is right aligned so that you can see the leaf name and options of the file. A <code>*</code> indicates that the file has been altered since last saved (sometimes you will get a <code>?</code> instead, which means that Zap isn't sure, but the file <em>may</em> have been changed). The view number is only shown if you have more than one view on a file.
</p>
<h3><a name="S3.2.1"></a>3.2.1 Titlebar options characters</h3>
<p>
The options characters are one or more of:
</p>
<ul><li>
<code>R</code> - permanent <a name="i4"></a>read only (ie: you can't make it non-read only).
</li>
<li>
<code>r</code> - currently <a name="i5"></a>read only, but can be made read/write (see <a href="Chapter9#S9.2">section 9.2</a>).
</li>
<li>
<code>D</code> - this is a <a name="i6"></a>DOS text file: line feeds will be converted to [CR][LF] on saving (see <a href="Chapter6#S6.9">section 6.9</a>).
</li>
<li>
<code>S</code> - this is a <a name="i7"></a>Spool text file: line feeds will be converted to [LF][CR] on saving (see <a href="Chapter6#S6.9">section 6.9</a>).
</li>
<li>
<code>p</code> - strip spaces on saving (see <a href="Chapter6#S6.9">section 6.9</a>).
</li>
<li>
<code>B</code> - <a name="i8"></a>Block edit mode is on (see <a href="Chapter6#S6.6">section 6.6</a>).
</li>
<li>
<code>A</code> - File has non-standard attributes (update using OS_GBPB).
</li>
<li>
<code>u</code> - <a name="i9"></a>Undo is enabled for this file.
</li>
<li>
<code>o</code> - <a name="i10"></a>Overwrite (typing in characters overwrites whatever's at the cursor - see <a href="Chapter6#S6.8">section 6.8</a>).
</li>
<li>
<code>h</code> - <a name="i11"></a>Hex entry (used by Byte, HalfWord, Word and DoubleWord modes - see <a href="Chapter10#S10.1">section 10.1</a>) is enabled.
</li>
<li>
<code>w</code> - <a name="i12"></a>Wordwrap is enabled (see <a href="Chapter6#S6.3">section 6.3</a>).
</li>
<li>
<code>L</code> - <a name="i13"></a>Line wrap is enabled (see <a href="Chapter6#S6.3">section 6.3</a>).
</li>
<li>
<code>l</code> - <a name="i14"></a>Line edit is enabled (see <a href="Chapter6#S6.7">section 6.7</a>).
</li>
<li>
<code>n</code> - <a name="i15"></a>Non-standard is enabled (see <a href="Chapter6#S6.8">section 6.8</a>).
</li>
<li>
<code>a</code> - <a name="i16"></a>Auto indent is enabled (see <a href="Chapter6#S6.1">section 6.1</a>).
</li>
<li>
<code>W</code> - <a name="i17"></a>Window wrap is enabled (see <a href="Chapter6#S6.3">section 6.3</a>).
</li>
<li>
<code>s</code> - <a name="i18"></a>Soft wrap is enabled (see <a href="Chapter6#S6.3">section 6.3</a>).
</li>
</ul>
<h2><a name="S3.3"></a>3.3 Basic editing</h2>
<p>
Now we've got a new file, we probably ought to alter it in some way. First we need to briefly talk about Zap's cursor.
</p>
<h3><a name="S3.3.1"></a>3.3.1 Zap's cursors</h3>
<p>
Unlike <a name="i19"></a><em>Edit</em>, which has a <em>point cursor</em> - a single line which indicates where text that you type will be entered, Zap has a <em>block cursor</em>. When you open a new file, you will see it sitting at the top left of the window. Text you type will get inserted immediately to the left of the block cursor (unless you have <a name="i20"></a>overwrite turned on, in which case typing a character will overwrite the character displayed in the block cursor with the new character that you typed). You can position the cursor by clicking <code>Select</code> with the mouse (the mouse can also be used for other things - see <a href="Chapter5#C5">chapter 5</a> for more information).
</p>
<p>
That said, you can now happily type some text in; the cursor keys work in the way you would expect.
</p>
<p>
Zap also has another three cursors. Firstly, it has a <em>mark cursor</em>. This shows where the cursor <em>would</em> be in a window that doesn't have the focus. To see this, open two new text files, and type some text into each. Resize them so you can see both - and you will see that the window with the focus has a block cursor, while the window without the focus has an empty square mark cursor to indicate where the cursor was when you last used that window. Clicking <code>Select</code> both sets the focus to the window you clicked on and moves the cursor; if you want to set the focus to a window, but not set the cursor, click <code>Adjust</code> - this will position the cursor where the mark cursor was. This way you can quickly move between windows with the mouse without having to click accurately to keep the cursor where you want it.
</p>
<p>
Secondly, Zap has a pair of <a name="i21"></a>copy cursors<em>copy cursors</em>. If you turn copy mode on by pressing <code>sCopy</code> (hold down <code>Shift</code> and press the <code>Copy</code> key), you will have two separate cursors (although they will initially be at the same position, so you won't be able to see this). One, a block cursor will remain in place, while the other, a thin line drawn under the character it's at, can be moved around the file. In copy mode, pressing <code>sCopy</code> will copy the character under the line cursor to the position of the block cursor. Pressing <code>Escape</code> or <code>Return</code> will cancel copy mode. (This works in the way you'd expect from using the <code>Copy</code> key in BASIC or from the command line.)
</p>
<p>
You can configure how Zap draws its different cursors - see <a href="Chapter12#S12.2.3">section 12.2.3</a>.
</p>
<h2><a name="S3.4"></a>3.4 Keyboard shortcuts</h2>
<p>
Many applications have some keyboard shortcuts to help you perform common operations quickly. Zap has lots of keyboard shortcuts, so that not only common operations but also less common ones can all be performed without having to move your hands from the keyboard. As with everything else, what each keypress does can be configured - see <a href="Chapter12#S12.3.3">section 12.3.3</a> for more information; you might also like to look at <a href="Chapter6#S6.4">section 6.4</a>, which allows both for a series of keypresses to perform an action (eg: <code>scF11 cX cS</code> saves the file), and for different modes to have the same keypresses doing different things.
</p>
<p>
Keystrokes are shown on Zap's menus, where they are displayed using <code>^</code> to stand for <code>Control</code>, and an up arrow to stand for <code>Shift</code> (eg: <code>^F3</code>). In this manual we will use <code>s</code> for <code>Shift</code> and <code>c</code> for <code>Control</code> (eg: <code>cF3</code>, <code>scW</code>). <code>Control</code> and <code>Shift</code> are <em>modifiers</em> - you hold them down while you press the key named afterwards. The keynames should all be fairly obvious; if it starts with <code>k</code> it means the named key on the keypad at the right of the keyboard (eg: <code>k0</code>, <code>kEnter</code>, <code>sk1</code> and so on).
</p>
<p>
For a complete list of Zap's default keystrokes, see <a href="AppendixA#AA">appendix A</a>.
</p>
<h3><a name="S3.4.1"></a>3.4.1 Moving around your file</h3>
<p>
You will probably already be familiar with the way cursor keys work. Not only can you use them to move around, one character or one line at a time, but you can use them to move quickly around your file. Their complete operation is as follows:
</p>
<ul><li>
<code>Left</code> - Moves left one character.
</li>
<li>
<code>Right</code> - Moves right one character.
</li>
<li>
<code>Up</code> - Moves up one line.
</li>
<li>
<code>Down</code> - Moves down one line.
</li>
<li>
<code>sLeft</code> - Moves left one word (see <a href="Chapter6#S6.5">section 6.5</a>).
</li>
<li>
<code>sRight</code> - Moves right one word (see <a href="Chapter6#S6.5">section 6.5</a>).
</li>
<li>
<code>sUp/PageUp</code> - Moves up one page.
</li>
<li>
<code>sDown</code>/<code>PageDown</code> - Moves down one page.
</li>
<li>
<code>scUp</code> - Scrolls the window up one line without moving the cursor.
</li>
<li>
<code>scDown</code> - Scrolls the window down one line without moving the cursor.
</li>
<li>
<code>scLeft</code> - Scrolls the window left one character without moving the cursor.
</li>
<li>
<code>scRight</code> - Scrolls the window right one character without moving the cursor.
</li>
</ul>
<h3><a name="S3.4.2"></a>3.4.2 Other useful keystrokes</h3>
<p>
Zap's default configuration also contains many of the standard <a name="i22"></a>RISC OS shortcuts. For instance, the <a name="i23"></a>save box is opened by pressing <code>F3</code>, and the selection keys (<code>cZ</code>, <code>cX</code>, <code>cC</code> and <code>cV</code>) work as expected.
</p>
<p>
Some other useful keys are (these are clearly our idea of what is useful!):
</p>
<ul><li>
<code>F2</code> - Load the named file.
</li>
<li>
<code>cF2</code> - Close current window.
</li>
<li>
<code>sF3</code> - Open the <a name="i24"></a>save selection box.
</li>
<li>
<code>cF3</code> - <a name="i25"></a>Save the file without opening the save box.
</li>
<li>
<code>F4</code> - Bring up the <a name="i26"></a>search box (see <a href="Chapter8#C8">chapter 8</a>).
</li>
<li>
<code>sF4</code> - Bring up the <a name="i27"></a>replace box (see <a href="Chapter8#C8">chapter 8</a>).
</li>
<li>
<code>cF4</code> - Open a new window on this file.
</li>
<li>
<code>F5</code> - Bring up the <a name="i28"></a>goto line/address box.
</li>
<li>
<code>F6</code> - Drop a <a name="i29"></a>mark (see <a href="Chapter9#S9.1">section 9.1</a>).
</li>
<li>
<code>sF6</code> - Jump to last <a name="i30"></a>mark (see <a href="Chapter9#S9.1">section 9.1</a>).
</li>
<li>
<code>F7</code> - Bring up the <a name="i31"></a>search to buffer box (see <a href="Chapter8#C8">chapter 8</a>).
</li>
<li>
<code>sF7</code> - Next match in <a name="i32"></a>search (see <a href="Chapter8#C8">chapter 8</a>).
</li>
<li>
<code>cF7</code> - Previous match in <a name="i33"></a>search (see <a href="Chapter8#C8">chapter 8</a>).
</li>
<li>
<code>F8</code> - <a name="i34"></a>Undo last operation (see <a href="#S3.5.1">section 3.5.1</a>).
</li>
<li>
<code>F9</code> - <a name="i35"></a>Redo last operation (see <a href="#S3.5.1">section 3.5.1</a>).
</li>
<li>
<code>sF9</code> - Jump to next <a name="i36"></a>mark (see <a href="Chapter9#S9.1">section 9.1</a>).
</li>
<li>
<code>scF1</code>-<code>scF10</code> - Switch mode (see <a href="Chapter10#C10">chapter 10</a>).
</li>
<li>
<code>Insert</code> - Toggle between insert and <a name="i37"></a>overwrite.
</li>
<li>
<code>Print</code> - Send file direct to printer ('<a name="i38"></a>quick print') - see <a href="Chapter7#S7.5">section 7.5</a>.
</li>
<li>
<code>sPrint</code> - Print file through printer driver ('<a name="i39"></a>fancy print') - see <a href="Chapter7#S7.5">section 7.5</a>.
</li>
<li>
<code>scSpace</code> - Remove excess spacing around the cursor.
</li>
<li>
<code>sDelete</code> - Delete next character.
</li>
<li>
<code>cDelete</code> - Delete current line.
</li>
<li>
<code>scDelete</code> - Delete to end of line.
</li>
<li>
<code>cCopy</code> - Start/end <a name="i40"></a>selection (see <a href="Chapter4#C4">chapter 4</a>).
</li>
<li>
<code>cEscape</code> - Enter command into <a name="i41"></a>minibuffer (see <a href="#S3.4.4">section 3.4.4</a> and <a href="Chapter9#S9.4">section 9.4</a>).
</li>
<li>
<code>cQ</code> - Quote following character (see <a href="#S3.5.2">section 3.5.2</a>).
</li>
<li>
<code>cR</code> - Reverse search 'as you type' (or <a name="i42"></a>i-search) - see <a href="Chapter8#C8">chapter 8</a>.
</li>
<li>
<code>cS</code> - Search 'as you type' (or <a name="i43"></a>i-search) - see <a href="Chapter8#C8">chapter 8</a>.
</li>
<li>
<code>cH</code> - Get content sensitive help using <a name="i44"></a><em>StrongHelp</em>.
</li>
</ul>
<h3><a name="S3.4.3"></a>3.4.3 Keystrokes in dialogue boxes</h3>
<p>
Zap's dialogue boxes all work in a consistent manner. Firstly, pressing <code>Return</code> always closes the dialogue and performs the action for that dialogue box. Secondly, the <code>Up</code> and <code>Down</code> keys always move between writeable fields, and the <code>Tab</code> key always moves onto the next field. These features are common with all normal <a name="i45"></a>RISC OS applications.
</p>
<p>
An additional feature with Zap dialogue boxes is that all buttons in the dialogue box will act as if clicked if you hold down <code>Control</code> and press the first capitalised letter in the button's descriptive text. For instance, in the <a name="i46"></a>goto line/address dialogue box (<code>F5</code>) the number you input in the writeable field can be interpreted in three ways: as a logical line, as (<code>x,y</code>) coordinates, or as an address. Each option (Logical line, Coordinates, Address) has its first letter capitalised (in some dialogues, the first letters clash and some options will have later letters capitalised) - so <code>cL</code> selects logical line, <code>cC</code> coordinates and <code>cA</code> address. In dialogue boxes without writable icons, you can simply press the first capitalised letter (ie: you don't have to hold down <code>Control</code> first).
</p>
<p>
Some dialogue boxes will have specific other keystrokes - for instance the search dialogues have commands to access the search history. Where it makes sense, some dialogues will use <code>cP</code> to insert Zap's current selection into the writable icon at the caret.
</p>
<h3><a name="S3.4.4"></a>3.4.4 Zap's minibuffer</h3>
<p>
Sometimes you will run a command in Zap which needs more information - for instance <code>cW</code> sets the width for the window you're working on, but you need to tell it <em>what</em> width to use. In cases such as this, Zap will open a '<a name="i47"></a>minibuffer' for you to type information into; this temporarily replaces the horizontal scrollbar.
</p>
<p>
(You can actually configure the minibuffer to be present constantly; see <a href="Chapter12#S12.2.4">section 12.2.4</a>.)
</p>
<p>
If you drag a file or directory into the minibuffer, its full pathname is inserted.
</p>
<p>
Several control keys have default meanings in the minibuffer. These cannot be reconfigured, but are compatible with the <a name="i48"></a><em>Emacs</em> minibuffer keys:
</p>
<ul><li>
<code>cA</code> / <code>cLeft</code> - Move to start of line.
</li>
<li>
<code>cB</code> / <code>Left</code> - Move back a character.
</li>
<li>
<code>cD</code> / <code>sDelete</code> - Delete the next character.
</li>
<li>
<code>cE</code> / <code>cRight</code> - Move to end of line.
</li>
<li>
<code>cF</code> / <code>Right</code> - Move forward a character.
</li>
<li>
<code>cG</code> / <code>Escape</code> - Quit the minibuffer.
</li>
<li>
<code>cK</code> - Clear minibuffer's history buffer.
</li>
<li>
<code>cP</code> - Paste the current selection (in Zap) into the buffer.
</li>
<li>
<code>cCopy</code> - Delete to end of line.
</li>
<li>
<code>sCopy</code> - Delete word to right.
</li>
<li>
<code>cU</code> - Clear minibuffer.
</li>
<li>
<code>cW</code> - Paste the contents to the cursor position.
</li>
<li>
<code>Tab</code> - Complete key (eg after pressing <code>F2</code>, <code>Tab</code> will complete filenames).
</li>
<li>
<code>Return</code> - Execute the command.
</li>
<li>
<code>sLeft</code> / <code>sRight</code> - Move the cursor a word at a time.
</li>
<li>
<code>cLeft</code> / <code>cRight</code> - Move the cursor to the start / end of the line.
</li>
</ul>
<p>
If you have the <a name="i49"></a>Line editor module loaded (see <a href="Chapter13#S13.2.1">section 13.2.1</a>):.
</p>
<ul><li>
<code>Up</code> / <code>sUp</code> - Recall line.
</li>
<li>
<code>Down</code> / <code>sDown</code> - Next line.
</li>
<li>
<code>cUp</code> - First line in recall buffer.
</li>
<li>
<code>cDown</code> - Last line in recall buffer.
</li>
</ul>
<p>
The last four can be redefined by commands to the Line editor module, but you will probably want to keep them consistent with the rest of the commands for the minibuffer. For information on configuring the Line editor, see the files in <code>!Zap.Code.Extensions.LineEditor</code>.
</p>
<p>
In addition, you can access the recall buffer by clicking <code>Menu</code> over the minibuffer. You can also drag the minibuffer around with <code>Select</code>, and resize it with <code>Adjust</code>, although this gets reset next time the minibuffer is opened - it is of use primarily if you configure the minibuffer to be open all the time (see <a href="Chapter12#S12.2.4">section 12.2.4</a>).
</p>
<p>
One particular use of the minibuffer is to give commands directly to Zap. All Zap's menus and keystrokes are defined in terms of the commands, which are explored further in <a href="Chapter9#S9.4">section 9.4</a>. All you need to know for the moment is that <code>cEscape</code> opens the minibuffer and allows you to type a command directly. For instance, if you want to open the save box, type <code>cEscape</code>, enter <code>SAVE</code> into the minibuffer, and press <code>Return</code>. The minibuffer will close automatically, and the save box will open - just as if you'd pressed <code>F3</code>.
</p>
<h2><a name="S3.5"></a>3.5 Further editing</h2>
<p>
Now we introduce undo and redo (enabling you to recover from mistakes), quoting (which allows you to insert any character into your file), and inserting files.
</p>
<h3><a name="S3.5.1"></a>3.5.1 Undo and redo: recovering from mistakes</h3>
<p>
Often you will make a mistake and need to recover from it; you may have deleted a section, or formatted a paragraph you didn't mean to. Pressing <code>F8</code> will <a name="i50"></a>undo your last action. Zap stores undo information right back until when you loaded or created the file, so you can undo several actions in a row. Of course, this can take a lot of memory - if you find that you are running short on memory you can turn undo off: it's in the File submenu.
</p>
<p>
Of course, just having undo would be a bit limiting - so pressing <code>F9</code> <a name="i51"></a>redoes your last undo step. For instance, if you insert the letter <code>a</code>, then press <code>F8</code> the <code>a</code> will disappear - pressing <code>F9</code> will bring it back again.
</p>
<p>
Zap actually has two different forms of undo, fast and full. Fast takes the fastest route through the undo tree, and full follows it step by step - an example should make this clearer.
</p>
<p>
Suppose you insert the letters <code>a</code> then <code>b</code>, and then undo the last step. Now insert the letter <code>c</code> - so you have <code>ac</code>. If you undo the last step, you are left with just <code>a</code> again, and up to this point fast and full undo will behave in the same way. However if you undo <em>another</em> step, there are two choices: fast undo will remove the <code>a</code>, while full undo will insert the <code>b</code>.
</p>
<p>
Pressing <code>F8</code> gives you fast undo; <code>scBackspace</code> is full undo.
</p>
<h3><a name="S3.5.2"></a>3.5.2 Quoting characters</h3>
<p>
As we've already seen, Zap uses most combinations of <code>Control</code> and an alphabetic character to perform useful actions; therefore you can't use them to enter <em>control characters</em> - characters which you can't type on the keyboard. Instead, you can 'quote' the character you want, by pressing <code>cQ</code> (hold down control and press <code>Q</code>) and then typing the control character you want. For instance, <code>cQ cA</code> will insert and byte of value 1 (which is <code>cA</code>). Use <code>cQ cSpace</code> for a byte of value 0.
</p>
<p>
An alternative is to change into Byte mode, type the digits in hexadecimal, and then switch back to whatever mode you were working in - see <a href="Chapter10#C10">chapter 10</a> for more information about modes in general, and <a href="Chapter10#S10.1">section 10.1</a> for details on Byte mode.
</p>
<p>
Control characters are displayed by Zap in blue, as opposed to white - see <a href="Chapter7#S7.3">section 7.3</a> for more information.
</p>
<h3><a name="S3.5.3"></a>3.5.3 Inserting files</h3>
<p>
You can drag a file directly into a Zap window to insert its contents at the cursor. If you hold down <code>Shift</code>, then the filename of the file will be inserted instead.
</p>
<p>
You can also save from another application into Zap; this will always insert the file's contents.
</p>
<p>
Another way of inserting a file is to use the <code>INSERTFILE</code> command, which is available from the <code>Misc-&gt;Insert</code> menu. This will open the minibuffer to let you type in the filename. You can also prefix the filename with one or more of <code>|</code> and <code>*</code> - the first will indent the text as if you'd typed it in, and the second will run the file through <code>GSTrans</code> first, to allow you to use system variables.
</p>
<h2><a name="S3.6"></a>3.6 Saving and closing files</h2>
<p>
In order to save your changes, bring up the <a name="i52"></a>save box by pressing <code>F3</code>, clicking on the <code>File</code> item in the main window menu, or opening it from the menu tree as <code>File-&gt;Save-&gt;(Save box)</code>. While this doesn't look like a normal <a name="i53"></a>RISC OS save box, it essentially is - just with more information available to you. The icon at the top left is draggable as you'd expect, and the filename is near the bottom. In addition, the middle section gives you some information about the file - its current size, and the date and time it was last altered - and the top right allows you to change the filetype. You can either type in a new filetype (the upper icon allows you to type it in as text, while the lower one is numeric), or you can use the menu to get a list of filetypes.
</p>
<p>
Zap will warn you if you are about to overwrite a more recent file (the warning can be turned off - see <a href="Chapter12#S12.3.1">section 12.3.1</a>).
</p>
<p>
If you want to save the file quickly, without having to confirm the filename, you can press <code>cF3</code>, or click on <code>File-&gt;Save</code> in the menu. This is known as a '<a name="i54"></a>quick save'.
</p>
<p>
<code>cF2</code> closes the current window; when there are no more windows open on a particular file that file will be removed from Zap's memory. At this point, if you have made any changes, Zap will ask you whether you want to save the file to preserve your changes, discard it, or cancel (therefore not closing the last window). Similarly if you try to quit Zap with some modified files still hanging around, it will ask whether you want to lose your changes.
</p>
<p>
(Zap has an option to allow files to stay in memory even when you've closed all windows. This is similar to the way <a name="i55"></a><em>Impression</em>, and some other applications, handle things - for more information, see <a href="Chapter12#S12.3.1">section 12.3.1</a>.)
</p>
<h3><a name="S3.6.1"></a>3.6.1 Automatic <a name="i56"></a>backups</h3>
<p>
When you save a file, Zap will usually overwrite whatever was saved on disc under that filename. However, in many cases - particularly when you're programming - you might want to keep old versions of the files. While you could make sure you always move the old version before saving, it would be easy to forget - so Zap has a method for doing this for you.
</p>
<p>
When you save a file, Zap looks for a directory called <code>~</code> (just the tilde sign). If it exists, Zap will first move the old copy of the file into that directory (overwriting anything with the same name already there). If you want more than one old version, you can do that by having a number of directories called <code>~&lt;number&gt;</code> - eg: <code>~1</code>, <code>~2</code>, <code>~3</code> ... <code>~n</code>, and Zap will then keep the last n versions of the file. Zap won't bother backing up a file if you've saved to it in the last two minutes - so if you save every time you type a character you won't get a series of backup files with very little difference between them. (The length of time Zap will wait between backups can be configured - see <a href="Chapter12#S12.3.1">section 12.3.1</a>.)
</p>
<hr>
<p>
The next section in the manual is <a href="Chapter4#C4">chapter 4</a>, which also covers moving blocks of text around the file, to other files, or even to other applications. It also covers various operations you can perform on blocks of text, such as sorting.
</p>
<p>
Alternatively, you might like to move on to <a href="Chapter6#C6">chapter 6</a>, which covers tabbing, wrapping and formatting, and other advanced editing issues.
</p>

<hr><address><a href='/copyright'>&copy; Copyright Zap Developers 1992-2004</a>. All Rights Reserved.
</address></body>
</html>
