Editing Text

Selections

Text is selected using the left mouse button:
press the button over the first character to be selected,
while being pressed, move the mouse pointer to the end position
release the mouse button.
The current selection will be highlighted. Pressing the left mouse button again makes the system forget the old selection and start a new one, except when you press the SHIFT key while pressing the button.
In this case, the current selection will be expanded. You can expand a selection at any time, even if you leave and reenter the view containing the selection. It is therefore possible, to scroll the view (using the scrollbar) or perform any other function (page up or page down) needed to make the desired end position visible. A selection can be expanded in both directions, any number of times.

It is also possible to move the mouse pointer out of the view, while the mouse button is being pressed. The view will then start to automatically scroll. The farther away you move the pointer from the views border, the faster will it scroll. This is the easiest way of selecting text: just let it scroll by and stop when the end position arrives.

Double click will select wordwise, while triple click will select linewise. If you keep the button pressed after such a multi-click and start to move, it will go on selecting wordwise or linewise.

A quadruple click selects the whole text.

Popup Menu Functions

All views showing text offer the usual edit functions via a pop-up-menu, which is activated with the right mouse button.

Keyboard Shortcut Functions

Most functions of the popup menus are also available via keyboard shortcuts. Actually, some functions are only available via the keyboard. In general, keyboard functions are activated by pressing either the Control or the Command key along with another key. Depending on your keyboard, the keys may also be labeled CTRL or META respectively. On some keyboards, the Command key is labeled ALT.

Typically, all CTRL functions perform cursor positioning functions, while the CMD functions modify the text or the current selection (but there are a few exceptions to this).

Additional Functions to Select Text

CMD-SHIFT-'A'
select all
selects the whole text from the very first line to the very last line.

CMD-'w'
select word
selects the word under the cursor. If there is blank space under the cursor, all space between the surrounding words or to either end of the current line is selected. Thus, to join two text lines, select the space at the line end and cut it.

CMD-'m'
select matching
selects the text delimited by matching parenthesis. If the cursor is currently positioned on any '(', '[' or '{'-character, the corresponding closing parenthesis is found forward in the text, and all text between those including the parenthesises is selected. Likewise, if the cursor is positioned on a closing parenthesis, the search is backward for the corresponding opening parenthesis.
If no matching parenthesis is found, or the nesting is corrupted, no selection is made.

ESC
select from the beginning of the line up to the current cursor position. (See below for the definition of doIt; to evaluate something in a workspace, you have to press two keys only: ESC followed by CMD-'d'.)

Editing

command key functions:

CMD-'x'
cut
the selected text is deleted from the text and put into the Cut&Paste buffer

CMD-'c'
copy
the selected text is copied into the Cut&Paste buffer

CMD-'v'
paste
the contents of the Cut&Paste buffer is inserted at the current cursor position. If there is currently a selection, the selected text will be replaced. Notice that making selections in other (non Smalltalk) views may also put the selection into this Cut&Paste buffer. Therefore, it is possible to select some text in an xterm window and paste it into some Smalltalk view. In contrast to Smalltalk views, most X views automatically perform the copy function when text is selected.

CMD-'s'
search
open up a panel to start a string search

CMD-'f'
forward search
search forward for the next occurrence of the selection or last search string. Ring the bell, (and show a cross-cursor for a moment) if not found.

CMD-'b'
backward search
same as above, but search backward.

Some keyboards (for example on Sun workstations) provide function keys labeled "copy", "cut", "paste" and so on. These keys will usually also perform the expected functions.

Control Key Functions for Cursor Positioning

Ctrl-'a'
start of line
position the cursor to the begin of the current line

Ctrl-'e'
end of line
position the cursor to the end of the current line

Ctrl-'m'
match
position the cursor on the matching parenthesis. Ring the bell if none is found or if the parenthesis nesting is wrong.

SHIFT-RETURN
non inserting cursor return
moves the cursor to the beginning of the next line, but does not insert a line break.

SHIFT-TAB
non inserting tabulator
moves the cursor to the next tabulator position, but does not insert a tabulator.

HOME
home
move the cursor to the very beginning of the text

END
end
move the cursor to the very end of the text

PAGEUP
next page
scroll backward to make the previous page visible. A page is usually the number of visible lines in the view.

PAGEDOWN
previous page
scroll forward to make the next page visible. A page is usually the number of visible lines in the view.

Executing Smalltalk Expressions

The following additional keyboard commands are available in all views which show code (i.e. in Workspaces and the Browser's code view):

CMD-'d'
doIt
the selected text is evaluated as a Smalltalk expression

CMD-'p'
printIt
the selected text is evaluated as a Smalltalk expression and the result inserted as new selection (so that a simple cut will remove this new text).

CMD-'i'
inspectIt
the selected text is evaluated as a Smalltalk expression, and an Inspector is started on the result.

Saving Code/Text; Compiling

The following are available in the FileBrowser and SystemBrowser:

CMD-'a'
accept
the whole text (not just the selection) will replace the old text. The actual function performed by this depends on the context in which it is executed; for example in a FileBrowser, the (modified) text will be saved back to the disk file. In a SystemBrowser, the current method or class definition will be re-compiled and installed. In other applications, different interpretations of accepting may be used.

There are even more functions, see the methods keyPress:... in TextView and subclasses, especially EditTextView. You can also easily add more functions there.

All keyboard functions are bound to their key by use of a mapping table, called the KeyboardMap. The definition of the this map is done during early startup from within the "display.rc" file. You can change the mapping and/or add new keyboard functions there.

Notice, that you can define your private "display.rc" file or use the default. The system uses the default file (in "/usr/lib/smalltalk" or "/usr/local/lib/smalltalk") if you don't have a private one.
A private version can be put into your current directory or "~/.smalltalk". (where '~' is the name of your home directory).

Sorry: currently there is no undo function, however no change in the text will have any effect until you accepted the new text.


Doc $Revision: 1.8 $ $Date: 2016/09/14 09:41:12 $