The Text object

Most of the user interface for Text is handled by the Application Kit's Text object.  Of special note are the guidelines for making and extending a selection.

The 2.0 guidelines reaffirm that the Shift key should be used for discontinuous extension of the selection and the Alternate key for continuous extension.  An application should also use the Shift key for the continuous extension of a text selection if it doesn't implement discontinuous selection of text.  In any case, users must be able to use the Alternate key to extend a text selection.

The Arrow Keys

In text, the arrow keys are used to position the insertion point or, when modified by the Alternate key, alter the selection.  But unlike the mouse, which can select anywhere within a document, the arrow keys operate only relative to the current selection.  The descriptions below assume that the current selection, before the user touches an arrow key, is a range of text.  The simpler case where the current selection is not a range but an insertion point is not directly addressed, but can easily be derived from the descriptions given.

When used alone (without a modifier key), the left arrow key positions the insertion point one character before the beginning of the current selection.  The right arrow key puts the insertion point one character beyond the end of the current selection.  These keys move the insertion point to the previous or next line if necessary.

The up arrow key puts the insertion point one line above the beginning of the current selection, and the down arrow key puts it one line below the end of the current selection.  As the up and down arrow keys move it ( line to line, the insertion point maintains the same approximate distance from the left margin.  It falls at the end of any line that's shorter than that distance, but comes back out to the original distance when a line that's long enough is encountered.

The arrow keys never move the selection out of view; if necessary, the display scrolls to make the new insertion point visible.

Modifier keys alter the basic behavior of the arrow keys, but retain the basic orientation of each of the four keys.  Applications are encouraged to implement the following modifier-arrow combinations for text selection:

·	Control-arrow combinations.  Modified by the Control key, the arrow keys move the insertion point to the edge of the current display.  The left arrow key puts the insertion point before the first visible character on the line where the current selection begins, and the right arrow key puts it after the last visible character on the line where the current selection ends.

	The up arrow key positions the insertion point in the first visible line of the display, directly above the beginning of the current selection.  The down arrow key puts the insertion point in the last visible line, directly below the end of the current selection.

	When the insertion point is already at the edge of the currently visible display, the Control-arrow combination that would otherwise move it to that edge first scrolls the display (by the amount of a page scroll), then moves the insertion point to the edge of the new display.  Once the insertion point reaches the beginning of a line, the right arrow key won't move it further (e.g., to another line); the left arrow key won't move it once it reaches the end of a line.

·	Shift-arrow combinations.  Modified by the Shift key, the left arrow key positions the insertion point to the left of the current selection at the beginning of a word.  The right arrow key positions it to the right of the current selection at the end of a word.  Thus both keys move the insertion point from word to word.

	The up arrow key puts the insertion point at the beginning of the word one line directly above the beginning of the current selection.  The down arrow key puts it at the en( the word one line directly below the end of the current selection.  As the up and down arrow keys move the insertion point from line to line, they choose words that lie directly above or below the original starting point.  (In other words, the location of the insertion point can be calculated by the same rules that determine the edge of the selection when the user double-clicks and drags directly upward or directly downward.)

·	Alternate-arrow combinations.  Modified by the Alternate key, the arrow keys extend the current selection by one character or one line at a time.  Users choose which edge of the selection to modify by the arrow key they press first.

	When pressed first, the left arrow key moves the beginning of the current selection one character to the left (toward the beginning of the document).  Subsequently, the left and right arrow keys both act on this same edge of the selection, moving it one character to the left or right.  When pressed first, the right arrow key moves the end of the current selection one character to the right (toward the end of the document).  Subsequently, the left and right arrow keys both act on the end of the selection.

	When pressed first, the up arrow key moves the beginning of the current selection up one line.  Subsequently, the up and down arrow keys both move this same edge of the selection up and down a line.  When pressed first, the down arrow key moves the end of the current selection down one line.  Subsequently, the up and down arrow keys both move the end of the selection.

If the current selection isn't in view when the user presses an arrow key, the selection is first scrolled into view before the rules stated above apply.

More than one modifier key can be used in combination with an arrow key, with additive results.  Thus, Shift-Alternate-right arrow extends the selection to the end of a word, and Control-Shift-up arrow places the insertion point at the beginning of a word in the first visible line of the display.

When modified by the Command key, the up and down arrow keys reorder windows on the screen.  These key combinations are reserved by the system and cannot be used to position the insertion point in text.