Using Text Editor This chapter describes how to create and edit short documents such as memos, mail messages, or resource files using Text Editor.documentrestoringdocumenteditingtexteditingeditingtext or document Opening and Closing Text Editor Text Editorstarting There are several ways to start Text Editor from your desktop. To Open Text Editor Click the Text Editor control in the Front Panel.Text EditorFront Panel controlFront Panel Text Editor control Or, open the Personal Applications subpanel in the Front Panel and click the Text Editor control. Text Editor can also be started from the command line by typing this command in a Terminal window: dtpad filename & The file name is optional. To Close Text Editor Text Editorclosing Choose Close from the File menu or press Alt+F4. If your keyboard does not have an Alt key, ask your system administrator to identify the corresponding key. Text Editor Window Text Editorwindow You create and edit a document in the Text Editor window. The title bar displays the name of the current document. A new document is named (UNTITLED).
Text Editor window
You can optionally display a status line that reports the number of lines in your document and enables you to go to a specific line number. To Display the Status Line status linein Text Editor window Text Editorstatus line The status line displays the line number where the insertion cursor is located and the total number of lines in the document. It also reports Text Editor messages and indicates whether Overstrike mode is active. Choose Status Line from the Options menu. To remove the status line, choose Status Line again from the menu.
Opening and Saving Documents Text Editoropening document Text Editorsaving document You can create a new document or open an existing document. Opening a document displays the contents of a selected file in the Text Editor window. Saving a document stores the edited contents into a file. You can save a document to its original file or to a new file. To Create a New Document A new document named (UNTITLED) is create d when you start Text Editor.document creatingcreatingdocument To enter text in your document, see . You provide a new file name when you save the document. After finishing a document, you can create another document using the New command. Choose New from the File menu. The Text Editor window is cleared and a new document is created. If you have not saved your current document, a dialog box is displayed that enables you to save your document. To Save a Document to a New File documentsaving savingdocument to new file Text Editorsaving document to new file Choose Save As from the File menu. The Save As dialog box lists files and folders located in your current folder. You can store your document in the current folder, a subfolder, or a folder that you specify. If you used Wrap To Fit, the dialog box includes an additional choice about handling line endings. If Wrap To Fit is not set, the dialog box omits this choice (see ).
Save As dialog box
Optional. If you do not want to save the file to the current folder, choose a subfolder or indicate a different folder. For a subfolder, select the subfolder in the Folders list and press Return. For a different folder, use the .. (go up) icon to change to a folder or type its path name in the Enter path or folder name field. Type a new file name in the Enter file name field. Press Return or click OK.
To Save a Document to the Original File Text Editorsaving document to original file savingdocument to original file Choose Save from the File menu to save your work and continue editing your document. If you used Wrap To Fit, the Save dialog box includes an additional choice about handling line endings (see ). Opening an Existing Document You can open an existing document in these ways:documentopening existing <$startrange>opening existing document <$startrange> Open the document in Text Editor. Select the file icon in File Manager and choose Open from the File Manager Selected menu. Double-click the file icon in File Manager. Drag the document's file icon to the Text Editor control in the Front Panel. To Open an Existing Document from Text Editor Choose Open from the File menu. The Open a File dialog box lists files and folders in your current folder. You can browse the documents listed, or change to a new folder to locate other files on your system.
Open a File dialog box
Select the name of the document you want to open, or type the document name in the Enter file name field. Press Return or click OK.
You can also use this shortcut: double-click the document name in the dialog box.
To Open an Existing Document from File Manager Display the document's file icon in a File Manager window.documentopening existing from File ManagerFile Manageropening existing text document from
Document file icon
Open the document in one of the following ways: Double-click the document. Select the document, then choose Open from the File Manager Selected menu. Drag the document file icon to the Front Panel and drop the icon on the Text Editor control. documentopening existing <$endrange>opening existing document <$endrange>
Entering Text Text Editorentering text textentering As you create a document, you type and edit text. A cursor ( I) shows your current position. Characters are inserted unless you set Overstrike mode (see ). To Enter New Text Click in the document and start typing. To start a new line, press Return. Or, you can use the Wrap To Fit option to automatically wrap text at the edge of the window. To start a paragraph, press Return twice. Using Wrap To Fit Wrap To Fit controls whether lines are automatically wrapped to fit the width of the window. When Wrap To Fit is set on, lines are broken automatically at the edge of the window. Because these line breaks are dynamic, you can resize the Text Editor window and thedocument new lines in text automatically adjusts to fit the new window width. When you save your document, you decide whether to add a line break to each of the wrapped lines, or to retain the dynamic line endings. When you save your document, you choose one of these options: Add a newline character (hard return) to the end of each wrapped line to preserve each line ending as it currently appears. Or, preserve only line breaks that were created by pressing Return. To Set Wrap To Fit On or Off Text Editorword wrap Text EditorWrap To Fit option textautomatic wrapping documentword wrap word wrap Wrap to Fit, turning on and off To set Wrap To Fit on, choose the Wrap To Fit toggle button in the Options menu. To set Wrap To Fit off, choose the toggle button again. Entering Special Characters Text Editorspecial characters and special charactersin Text Editor Different systems often use certain key combinations to insert special characters. In some instances, a key combination may be reserved by Text Editor. For example, a Text Editor mnemonic for displaying a menu might conflict with a key sequence you want to use on your keyboard. To insert the correct character you may need to override the reserved behavior by preceding the key combination with Control+Q. Moving the Cursor in a Document Text Editorcursor keys As you enter and edit text, you move the insertion cursor using the mouse and keyboard cursor keys. Using the mouse, move the pointer to the new location in the document and click mouse button 1.navigatingmoving text insertion cursor You can also use the keyboard cursor movement keys:keyboardcursor movement keys in Text Editor cursor movement keys Key Cursor Movement Up Arrow Up one line Down Arrow Down one line Left Arrow Left one character Right Arrow Right one character Control+Left Arrow Move left to previous word Control+Right Arrow Move right to next word Home Beginning of the current line End End of the current line Control+Up Arrow Beginning of the previous paragraph Control+Down Arrow Beginning of the next paragraph Control+Home Beginning of the document Control+End End of the document Control+G To the Line field in the status line If your keyboard uses different key labels, ask your system administrator to identify the corresponding keys. To Go to a Specific Line documentgoing to specific line in navigatingto specific line in document Display the status line (see ). Press Control+G or click in the Line field of the status line. Type the line number you want to go to and press Return. To Scroll a Document Select and drag the vertical scroll bar to view more text. Use the horizontal scroll bar to view long lines. You can also use the scrolling keys: Key Scroll Movement Page Up Up one page Page Down Down one page Control+Page Up Left one page Control+Page Down Right one page Selecting Text selection, in Text Editor selectingtext textselecting Before using edit commands such as cut and paste, you must select the text. You can select text using the mouse or the keyboard. To Select Text with the Mouse Click at the beginning of the text you want to select. Press and hold mouse button 1 and drag to the end of the text. To deselect text, click any area in the window. To modify a selection you have made, press and hold the Shift key and mouse button 1. Then drag forward or backward to adjust the amount of selected text. Or, hold down the Shift key and one of the arrow keys to change the selection. You can also use these shortcuts for selecting text: Word Double-click the word Line Triple-click the line All text Quadruple-click in the text Secondary Selection This method enables you select text and replace it with another selection, which is used as the replacement text. To Replace Text Using Secondary Selection Select the text that you want to replace. Move the pointer to the beginning of the text you want to replace the first selection with. Hold down the Alt key and mouse button 2 and drag to the end of the text you want to use. The text is underlined. If your keyboard does not have an Alt key, ask your system administrator to identify the corresponding key. Release the Alt key and mouse button. The underlined text overwrites your first selection. To Select Text with the Keyboard Text to Select Action Text block Move the cursor to the beginning of the text block. Hold down the Shift key and an arrow key to move the cursor to the end of the text block. Cursor to beginning of line Shift+Home Cursor to end of line Shift+End Cursor to beginning of paragraph Shift+Control+Up Arrow Cursor to end of paragraph Shift+Control+Down Arrow Cursor to beginning of document Shift+Control+Home Cursor to end of document Shift+Control+End All text Control+/ Deselect all text Control+\ Editing Text Minor edits can be made using the editing keys. You may also want to copy, move, or delete portions of text, find and change a word or phrase, or check the spelling of your document. Editing Keys Text Editorediting keys Key Action Backspace Deletes the character before the cursor Delete Deletes the character following the insertion cursor Control+Backspace Deletes the previous word Shift+Backspace Deletes characters from the cursor to the beginning of the line Control+Delete (Control+Remove) Deletes all the characters from the cursor to the end of the current line Insert Toggles Overstrike and Insert mode Note that not all vendors' keyboards supply these keys. Please see your local vendor's documentation for alternate key bindings. Menu Shortcut Keys Text Editormenu shortcut keys shortcut keysin Text Editor You can also use these shortcut keys when making edits. Control+C Copy selected text Control+X Cut selected text Control+V Paste selected text Control+F Find/Change text Control+Z Undo a cut, delete, clear, include, copy, or paste command UNIX Key Bindings Text EditorUNIX (Emacs) key bindings UNIXTM key bindings enable you to use a set of extended Emacs keys, such as Alt+B (back word) or Control+N (next line), in Text Editor. To enable UNIX key bindings (which are set off by default) you edit a file in your home directory. To Enable UNIX Key Bindings UNIX key bindings Add the following line to the .Xdefaults file in your home directory: #include “/usr/dt/app-defaults/language/UNIXbindings” Replace language with the name of your language environment. If the .Xdefaults file does not exist, create the file in your home directory. Log out of your current session. Log in and restart Text Editor. Some Text Editor menu accelerators conflict with UNIX key bindings. When UNIX key bindings are enabled, Text Editor provides alternate menu accelerators for these commands: Command Alternate Menu Accelerator Find/Change (Control+F) Control+S Paste (Control+V) Shift+Insert Print (Control+P) no alternate accelerator Undo (Control+Z) Control+_ If you want to modify these menu accelerators, copy the contents of the /usr/dt/app-defaults/ language/UNIXbindings file into your .Xdefaults file and then make your changes. When using UNIX key bindings, the Delete key deletes the previous character rather than the character that follows the cursor. To Set Overstrike Mode overstrike mode, in Text EditorAs you type, new characters are inserted. If you want to type over existing characters, change to Overstrike mode. Choose Overstrike from the Options menu. To return to Insert mode, choose Overstrike again from the menu. Or, use the Insert key to switch between Insert and Overstrike mode. When Overstrike mode is on, the cursor changes to a block. If you use Overstrike mode often, you may want to display the status line (see ) because it indicates whether Overstrike mode is on or off. To Type Over Text Select the text. Type the replacement text. You can also choose Overstrike from the Options menu to turn off Insert mode and type over the text directly. To Delete Text deletingtext textdeleting Select the text. Choose Delete from the Edit menu or press the Delete key. Deleted text cannot be pasted, but it can be recovered with the Undo command (see ). If you intend to paste the text that you delete, use the Cut command (see ). To Clear Text The Clear command replaces the selected text with spaces or blank lines. Select the text to be cleared. Choose Clear from the Edit menu. To Undo an Edit Text Editorusing Undo in Undo, in Text Editor Choose Undo from the Edit menu or press Control+Z. Undo reverses the last cut, paste, clear, delete, change, include, or format operation. To Copy Text copyingtext textcopying Select the text to be copied. Choose Copy from the Edit menu or press Control+C. A copy of the text is stored on a clipboard where it can be accessed or replaced by other applications. Click where you want to insert the text. Choose Paste from the Edit menu or press Control+V. You can also use drag and drop to copy text (see ). Use this shortcut to copy a word or phrase: Select the text, move the pointer to where you want to insert the text, and click mouse button 2. This is a quick way to copy text into a dialog box. To Move Text (Cut and Paste) textcutting and pasting Select the text. Choose Cut from the Edit menu or press Control+X. The text is erased from the document and stored on a clipboard where it can be accessed or replaced by other applications. Move the cursor to where you want to insert the text. Choose Paste from the Edit menu or press Control+V. You can also use drag and drop to move text (see ). To Correct Misspelled Words spelling, correcting in Text Editor Choose Check Spelling from the Edit menu. The Spell dialog box lists misspelled or unrecognized words.
Spell dialog box
Select the misspelled word in the Misspelled Word list that you want to find and press Return. Or, just double-click the word. The next occurrence of the word is highlighted in your document. Type the correct word into the Change To field. Click Change to correct a single occurrence. To find and change additional occurrences, click Find and then Change. Or, click Change All to replace all occurrences. Click Close when you are done.
The Check Spelling feature is only available for the English language.
To Include a File documentincluding file in filesincluding in Text Editor document You can insert a text file into your document using a menu command or by dragging a file icon into the Text Editor window (see ). Position the cursor where you want to insert the text file. Choose Include from the File menu. The Include a File dialog box lists files and folders on your system. You can browse the documents listed, or change to a new folder to locate other files on your system.
Include a File dialog box
Select the document you want to insert in the Files list. Press Return or click OK.
Using Drag and Drop Text Editordrag and drop in textdragging textdropping draggingtext droppingtext filesdropping in Text Editor document filesincluding in document through drag and drop documentincluding file through drag and drop drag and drop, in Text Editor You can use drag and drop to move or copy text between Text Editor documents or other applications. You can also include a file into your document using drag and drop. To Move Text Using Drag and Drop Select the text that you want to move. With the pointer on the selection, press and hold mouse button 1, and drag to where you want to insert the text. Release the mouse button. The text is inserted into your document relative to the position of the drag icon. To Copy Text Using Drag and Drop Select the text you want to copy. With the pointer on the selection, press and hold the Control key and mouse button 1, and drag to where you want to copy the text. Release the Control key and mouse button. The text is copied relative to the position of the drag icon. To Include a File Using Drag and Drop draggingfile to Text Editordroppingfile in Text EditorWhen using drag and drop, the contents of the file are copied into the Text Editor window at the position of the insertion cursor. The original file remains intact. Click in your document where you want to include the file. Drag the file icon that you want to include into the Text Editor window. Searching a Document documentsearching search and replace, in Text Editor You can search for a word or phrase in your document. The Find command begins from the position of the insertion cursor and proceeds through the entire document. You can automatically replace or delete occurrences found in your document. Searches are case sensitive. To find all occurrences, search for both lowercase and uppercase instances. To Find Text textfinding in Text Editor Choose Find/Change from the Edit menu or press Control+F.
Find/Change dialog box
Type the text you want to find in the Find field. Press Return or click the Find button to locate the next occurrence of the text. To find additional occurrences, press Return or click Find again.
To Find and Change Text Choose Find/Change from the Edit menu or press Control+F. Type the text you want to find in the Find field. Type the replacement text in the Change To field. Press Return or click the Find button to locate the next occurrence of the text. Click Change to replace a single occurrence. To find and change additional occurrences, click Find and then Change. Or, click Change All to replace all occurrences. There is no Undo for Change All. Click Close when you are done. To Find and Delete Text Choose Find/Change from the Edit menu or press Control+F. Type the text you want to delete in the Find field. Leave the Change To field blank. Press Return or click Find to locate the next occurrence. Click Change to delete a single occurrence. To find and change additional occurrences, click Find and then Change. Or, click Change All to replace all occurrences. Click Close when you are done.
Formatting and Printing Documents Text Editorformatting document in formattingdocument in Text Editor documentformatting Once your editing is complete, format your document by choosing margins and text alignment. To Format a Document Text Editorformatting document in margins, document documentmargins justification, setting in Text Editor documentjustifying text in textjustifying Choose Settings from the Format menu.
Format Settings dialog box
Enter margins. The default left margin is 0 and the right margin is dynamically set to the width of the Text Editor window. Margins are specified as a number of character columns. Select left, right, justify (block style), or center alignment.textalignment Determine the scope of the formatting: To format a single paragraph, place the cursor in the paragraph, then click Paragraph. To format the entire document, click All. After closing the dialog box, choose Paragraph or All from the Format menu to apply the settings.
To Print an Open Document with Default Options Text Editorprinting document with default options printingdocument with default options documentprinting with default options Open the document in Text Editor. Choose Print from the File menu. To Print an Open Document with Specific Options Text Editorprinting document with specific options printingdocument with specific options documentprinting with specific options Open the document in Text Editor. Choose Print... from the File menu or press Control+P. The Print dialog box appears.
Print dialog box
To select a different printer, type the new printer name in the Printer Name field. To output multiple copies, type the number of copies in the Copies field. To print to a file, click the Print to File checkbox and type the path and filename for the file. To have long lines wrap to fit the page size, click the Use Word Wrap checkbox. To set the margins for the printed output, type the desired values in the Top, Left, Right, and Bottom fields. You can specify margin values in inches (in), centimeters (cm), or pixels (pi). The default value for all margins is one inch. If no unit value is specified, pixels are used. Your margin settings remain in effect until you change them. They are used when you print with default options. To include headers and/or footers on the printed output, choose the type of information you want for Top Left, Bottom Left, Top Right, and/or Bottom Right. For each position, you can select: Date, to display the current date. Document Name, to display the name of the document being printed. Page Number, to display page numbers. User Name, to display your user name. None, to display nothing. The following defaults are used: Top Left—None Top Right—Document Name Bottom Left—None Bottom Right—Page Number Your header and footer settings remain in effect until you change them. They are used when you print with default options.
To set printer-specific options, click the Setup... button on the Print dialog box. The Print Setup window appears. From this window, you can access both Printer and Job options.
Print Setup window
The Printer options dialog box lets you control such items as page orientation (portrait or landscape), page size (legal, letter, etc.), one- or two-sided printing, and which printer tray to use. The Job options dialog box lets you indicate whether you want an email notification sent when your print job completes and what text (if any) you want to appear on the banner page. You can also specify print command options in the Print Command Options field. When finished with the Print Setup window, click OK to set your changes and return to the Print dialog box. Your Print Setup settings remain in effect until you change them. They are used when you print with default options.
To send the open document to the printer from the Print dialog box, click Print.
To Print a Closed Document Display the document's file icon in File Manager. Drag the file icon to the Printer control in the Front Panel. The Print dialog box is opened. Optional. Set printing options. Click Print.
Recovering a File restoringText Editor file If Text Editor is interrupted due to a system error, it attempts to save your changes in a recovery file in your current folder. The recovery file is named # filename#, where filename is the name of the document. If you had never named your document, the recovery file name is #UNTITLED#. To Recover a File Start Text Editor. Open the recovery file. Save the document using your original file name or provide a new name for a previously unsaved document. Text Editor and Other Applications Text Editorused in other applications applicationsusing Text Editor with Other applications can use Text Editor as a tool to edit documents or other types of information. Under certain conditions, an application may choose to restrict your editing choices. In the example below, the File menu has been modified. The Save As command has been replaced with a Copy To File command and the New and Open commands are not available.
Text Editor with modified File menu