PPTools/Guiguts/Editing

From DPWiki
Jump to navigation Jump to search

Selecting Text

You select text in a variety of ways, most of which should be familiar:

click-drag Select the text over which you drag.
double-click Select the whole word under the cursor.
triple-click Select the whole line under the cursor.
shift-click Extend the selection to the point where you click.
shift-left-arrow Extend the selection one character left.
shift-right-arrow Extend the selection one character right.
shift-up-arrow Extend the selection one line upward.
shift-down-arrow Extend the selection one line downward.
shift-home Extend the selection to the left margin.
shift-end Extend the selection to the right margin.
shift-page up Extend the selection up one screen height.
shift-page-down Extend the selection down one screen height.
ctl-shift-left-arrow Extend the selection one word left.
ctl-shift-right-arrow Extend the selection one word right.
ctl-shift-up-arrow Extend the selection one paragraph upward.
ctl-shift-down-arrow Extend the selection one paragraph downward.
ctl-shift-home Extend the selection to the top of file.
ctl-shift-end Extend the selection to the end of file.
ctl-a or Edit>Select All Select the entire file.

When you use a cursor-moving key (arrows, home/end, page up/down), any selection is cleared. If you want to use shift-click to make a selection larger than the screen display, use the scrollbar or Search>Jump to Line to find the target to click.

If you lose a selection, for example by inadvertently using an arrow key, you can reselect the same area by right-clicking (Mac: ctl-clicking) the Selection field in the status bar.

Selection Dialog

Double-click in the selection field in the status bar to open a selection dialog:

Guiguts sel dialog.png

You can use this dialog to specify the selection exactly using the keyboard. (Caution: if you use this dialog to set a selection in a part of the file that is not visible in the window, Guiguts does not scroll to show the selection. Use the scroll bars or Search>Jump to Line to bring the selection into view.)

If you hold the shift key while dragging, you create a columnar selection (discussed below). If, while you are shift-clicking to extend a normal selection, you drag the mouse even slightly, Guiguts takes it as a shift-drag and makes a columnar selection: the selection blinks from full-width to a narrow column. Without moving the mouse, shift-click more carefully; the normal selection is restored.

Type, Cut, Copy, Paste

To replace text, select it and begin typing. What you type replaces the selection. If there is no selection, what you type goes into the document at the insertion point.

The familiar Cut, Copy, and Paste operations are available in the Edit menu and using the ctl-c, ctl-x, and ctl-v keys (the control-key on all platforms, including Mac).

Click the Insert/Overtype button in the status bar to switch between the usual insert mode, in which each keystroke or pasted letter is inserted into the document and text moves right to make room, and overtype mode. In overtype mode, each keystroke or pasted letter replaces the character at the insertion point.

Copy and Paste Between Documents and Programs

To copy text between documents, Copy in the first document: use File>Open to open the second, and Paste.

You can copy and paste between Guiguts and other applications. In Windows and Linux there is no special limit on the amount of text you can copy in Guiguts and paste into another application's window, or vice versa.

In Mac OS X, you can copy any amount of text in a Mac OS X application such as TextEdit and paste it into the Guiguts window. (The only difficulty is in remembering to use command-c in TextEdit but control-v in Guiguts.) However, Apple's X-windows puts a limit of approximately 4,000 bytes on the amount of text you can copy in Guiguts and paste into a Mac application. If you have copied more than 4,000 characters, nothing is pasted. (still true in 10.4.6; re-check in Leopard when out.)

Undo and Redo

Guiguts supports multiple levels of Undo. It keeps a log of recent editing operations. Apply Edit>Undo, control-z, or click Guiguts Tb-undo.png in the toolbar to undo actions from the most recent one back.

The Undo log is cleared when the file is saved using either File>Save or File>Save As, and when a file is opened. To Undo every change since the file was last saved, just re-open it without saving.

Most operations that are performed with a single click or command are undone with a single Undo. This is not true of all operations; for example when you click Replace All in the Search dialog, each of what may have been many replacements is a separate undo action. Watch the file carefully while applying undo and stop when it is in the state you want.

It is possible to undo a Rewrap operation of a small selection, but it is not advisable. Currently, page markers in the rewrapped text do not always return to their original positions when rewrap is undone. Instead of undoing a rewrap, select the text and wrap it again to the correct margins.

Generally you can Redo anything you Undo by applying Edit>Redo, control-y, or clicking Guiguts Tb-redo.png in the toolbar. Each Redo reverses the effect of one Undo. Another way to get the effect of Redo is to make a new, small change (for example, type space-backspace). Then begin clicking Undo: after undoing your new change, Undo will continue to Undo each Undo that preceded the change. The Undo of an Undo is logically equivalent to Redo, but uses a different path that may be more reliable than Redo.

Selecting Columns

Guiguts allows you to select a column of text and copy it, paste it, fill it, or move it horizontally. Columnar selections are supported mainly to help you work with ASCII tables. Columnar selections are not consistently integrated with the rest of the editing facilities and you can get odd results when using them in ways not explicitly intended.

To select a column, first clear any other selection by clicking in the text or pressing an arrow key. Then hold down a shift key and drag diagonally to select a rectangle of text. The selection field in the status bar shows the size of the selection; click in that field if necessary to make it show Row and Column sizes.

You cannot extend a columnar selection by shift-clicking; to change its size you must start over with a new selection.

With a columnar selection active you can fill the selection with flood-fill, and you can shift the selection left or right with the shift commands in the Selection menu.

Copy, Cut, and Paste of columnar data are primarily controlled with the F1, F2, and F3 keys respectively, or with the Edit menu. Use F2, Edit>Cut or control-x to delete a columnar selection and put it on the clipboard. Use F1, Edit>Copy or control-c to copy the text to the clipboard.

Use F3 or Edit>Col Paste to paste columnar data as a column. There should be no current selection when pasting. The column is inserted, row by row, with its upper-left corner at the insertion point. When the Typeover mode button in the status bar is set to Insert, the columnar patch is inserted, causing existing characters to shift to the right. When the Typeover mode is Overstrike, the columnar data overwrites existing text.

If you use control-v to paste the text of a column, it is not pasted as a column, but as if it were a small paragraph composed of short lines. If a selection is active when you paste a column with F3, the operation will combine with the selection in ways that are hard to predict and rarely useful.

Modifying with the Selection Menu

The Selection menu offers the following functions for changing the selected text.

lowercase selection Force all letters to lowercase.
Sentence case selection Capitalize the initial letter, lowercase all others.
Title Case Selection Capitalize all initial letters.
UPPERCASE Selection Force all letters to uppercase.
Surround Selection With... Encloses selection in chosen strings.
Flood Fill Selection With... Fills the selection with a chosen letter or string.
Indent Selection 1 Moves all the selection one byte right.
Indent Selection -1 Moves all the selection one byte left.
Rewrap Selection Wraps selected text to default margins, see this page
Block Rewrap Selection Wraps selected text to block margins, see this page
ASCII Boxes Frame the selection in a box made of + | - characters.
Align text on a string Align columnar text on decimal point, etc.
Convert To Named/Numeric Entities Special characters to &xxx; HTML entities.
Convert From Named/Numeric Entities HTML entities &xxx; to special characters.
Convert Fractions 1/4 to ¼, etc.

Surround Selection

The Surround Selection With... function opens a dialog box asking for the strings that are to enclose the selection:

Guiguts Surround.png

When you click OK, the string from the first field is inserted at the head of the selection; that from the second, at the end. You can enter any strings, for example HTML markup like <p class="foo"> and </p>. The Surround box remains on the screen until you close it. You can repeatedly select a target, click OK, and select again. In this way you can enter repetitive markup such as <td>...</td> rapidly.

When used with a columnar selection, Surround Selection inserts the strings at the ends of each row of the column. Thus you could use it, for example, to put stiles ("|") down each side of an ASCII table.

Flood Fill

The Flood Selection With... function opens a dialog box asking for a string to use in filling the selection:

Guiguts Flood.png

When you click OK, the entire selection is filled with repeats of that string. This is a convenient way to fill an area with spaces or fill a line with dashes. The box remains on the screen until you close it. You can repeatedly select a target, click OK, and select again, to rapidly fill many areas.

Even when the Flood Fill dialog is not visible, keying ctl-w invokes this function using the last-entered string, so you can use select then ctl-w to fill a space at any time. (However, if you hit ctl-w accidentally, you may be surprised when your selection is suddenly blanked.)

Flood fill works with a columnar selection, so you can use it, for example, to blank the center of a boxed table cell.

Shifting Left and Right

Indent by 1 shifts the selection right by inserting spaces at the left margin. Indent by -1 shifts the selection left by removing one space from the left margin of every line that has a space—lines that are already flush to the margin are not moved.

The shift functions are also available from the Windows keyboard as alt-left-arrow and alt-right-arrow. (Not available in Linux or Mac.)

These functions restore the selection so you can immediately click on the functions again. If you tear off the Selection Menu, you can shift a selection multiple spaces quickly by clicking repeatedly on the function.

The Indent functions work with a columnar selection, so you can use them to reposition the contents of a table cell.

Aligning Columns of Figures

Selection>Align Text on String opens a dialog for you to specify some character such as a decimal point or currency symbol. When you click OK, Guiguts moves the lines in the selection left or right so that the first occurrence of that symbol in each line is vertically aligned. For example, this text:

$10.20      
$1,024.65 
$244.86      

when aligned on the decimal point, changes to:

   $10.20      
$1,024.65 
  $244.86      

The Align function does not operate with a columnar selection, so cannot be used to adjust a column in a table cell.

Converting Named Entities

An etext may use characters from the Latin-1 set such as the sterling symbol £ or fractions ½, or Unicode characters, such as ă (a-breve). (See Character Codes and Compatibility for discussion.)

It is possible to retain these special symbols in the HTML etext, but it is preferable that the HTML etext be plain ASCII. You convert special symbols to plain ASCII by coding them as named or numeric "entities," for example, coding £ as &pound;, ½ as &frac12;, ă as &#259;, etc.

To convert all non-ASCII symbols in a block of text to named entities, select the text and use Selection>Convert To Named/Numeric Entities. To recover the special characters, select the text and apply Selection>Convert From Named/Numeric Entities.

Converting Fractions

To convert an expanded fraction such as "1/4" to a single character, select the string "1/4" and apply Convert Fractions. The string is replaced with the named entity &frac14;. If you really want the Latin-1 symbol ¼, re-select the named entity and apply Convert From Named/Numeric Entities. By this two-step process you can go from "1/4" to "¼".