Code Editor
Notice that some aspects of the editor can be customized. Especially the keyboard
shortcuts are defined in a file called "keyboard.rc" which is loaded at startup time.
If you don't like the default keyboard settings as described below,
feel free to place your own "keyboard.rc" file into your ST/X startup directory.
Most menu functions operate on the current text selection.
The menu is hierarchical, with less frequently used operations
to be found in submenus named "More" or "Other".
Shortkey commands are initialted by keeping either "Ctrl" and/or "Cmd"
(also named "Alt" or "Meta" on some keyboards).
On the Mac, using the XWindow version of ST/X,
the "Apple-Cmd" key is reserved for Window manager operations,
and not usable in ST/X, unless you have installed a custom keybord modifier map.
Here, the "Alt" key located next to the Cmd key is used (which may be annoying at times).
Shortkey commands are also described in the introductionary text,
"Editing Text",
so the following is only a reminder about the most common functions.
Shortkey commands are roughly grouped into
- Cursor Movement Keys
- Selection Keys
- Operation Keys
Cursor Movement Keys
These are usually CTRL-key combinations.
- CTRL-e / End: Move to End
Moves the text cursor to the end of the line.
If your keyboard has a key named "End", that has the same function.
- Pos1: Move to Begin
Moves the text cursor to the beginning of the line.
- CTRL-w: Next Word
Moves the text cursor to the beginning of the next word.
What exactly makes a "word" may depend on the contents, and the editor's setting.
For example, whether the "underline" character is treated like part of an
alphanumeric word, or not can be controlled by a toggle in the Launcher's settings dialog.
- CTRL-W (= CTRL-SHIFT-w): End of Word
Moves the text cursor to the end of the current or next word.
If the cursor is currently within a word, it is moved to the end of it.
If the cursor is already at the end of a word, it is moved to the end of the next word.
- CTRL-g: Goto Line
Opens a dialog asking for a line number.
Positions the cursor into that line.
Selection Keys
These are usually ALT-key combinations.
- ALT-w: Select Word
If there is currently no selection,
the word under the cursor is selected. If there is already a word selected,
the next word is selected.
- ALT-l: Select Line
If there is currently no selection,
the whole cursor line selected. Otherwise, the selection is expanded to include the
next line. Pressing Alt-l multiple times, allows for quick selection of a block of
lines.
- ALT-f: Forward Search
If there is a selection,
search forward for the next occurence of that string.
Typically this is used to search for words in the text.
If there is no selection, previously searched string is searched again.
See also ALT-s which opens a search box.
- ALT-b: Backward Search
If there is a selection,
search backward for the previous occurence of that string.
Typically used to search for words in the text.
If there is no selection, previously searched string is searched again.
See also ALT-s which opens a search box.
- ALT-s: Search
Opens a search dialog box, to enter a string
and possibly change the search behavior.
Operation Keys
- CTRL-z: Undo
Undo the last edit change. An arbitrary number of operations
can be undone, back to the original contents.
- CTRL-y: Redo
Oops, if you undid one too many.
- F3 / F4: Comment / Uncomment
Comment / uncomment the selected text.
If there is no selection, the current cursor line is affected.
On some machines, these functions are found on F4/F5,
because F3 is used by the window system.
- F9 / F10: Indent / Undent by Tab
Indent / undent the selected line(s) or the cursor line by the
tab space setting (see user preferences).
By default, Smalltalk/X uses multiples of 4 tab columns.
- F11 / F12: Indent / Undent by 1
As above, but inserts/removes a single space.
- F8: Again
Repeat the previous cut or replace operation.
Thus to replace some text at multiple places in the document,
select the word, type the replacement, then press Again.
Repeat Again until the end of the document is reached,
or select the "Again For All" menu function.
- CTRL-s: Save/Accept
Accept modifications / save contents. The details of this operation depend on
the context in which the editor operates: in a system browser, changed code is compiled
and installed. In a file browser, the changed contents is saved in the edited file.
In an inspectors right panel, a changed value is stored in the inspected object.
- ALT-a: Save/Accept
An alternative key combination. This is recognized for backward compatibility.
to keep old fashioned ST/X users happy.
The code view performs syntax coloring as you type.
A number of different coloring styles are availabe
and can be customized via the Launcher's settings dialog.
If enabled in the Launcher's settings dialog,
the editor offers code completions, either on the fly, "as you type",
or initiated by a key ("Tab" or "Ctrl").
When "as you type" completion is enabled, a floating window
presents plausible completions. This list is updated as you
type more or delete characters by backspacing.
The window is closed by pressing "Esc".
To select a completion, first navigate the list using the
"CursorUp" or "CursorDown" key, then press "Return".
Some users find it irritating that the cursor- and return keys are intercepted
this way. Those may check the "Shift/Control to Navigate in Completion" checkbox in the Launcher's
settings. If set, reguler key presses are handled as usual and
to navigate the completion list, press "Shift" (or "Ctrl")-"CursorKey"
and "Shift-Return".
The setting also includes check boxes named
"Tab" or "Ctrl"-completion.
If checked, the completion list appears when that key is pressed.
Snippets are little code fragments which appear often
in source code.
A predefined (but customizable) list of abbreviations is
defined in the Workspace class.
The snippet to be inserted is determined by the character(s)
before the cursor.
If a code completion list is presented, any applyable
snippet is also appended to this list (and can thus be easily
selected via CursorUp-Return.
The behavior can be adjusted via the Launcher's
"System"-"Settings"-"Tools"-"Editor" dialog.
The Cursor behavior of the editor can be configured to one of two modes:
- Rand-editor Mode (*)
- vi/emacs/st80-editor Mode
In "Rand-editor" mode, the window behaves like a piece of paper,
where the text-cursor can be positioned wherever you like,
simply by clicking there.
If required, spaces are inserted.
In "vi-editor" mode, the cursor can only positioned to a place after an actual character.
If you click to the right of the last character in a line, the cursor will be placed
right after the last character in that line.
If you click below the last line, it will be positioned at the end of the text.
Non-programmers usually find the "Rand-editor" behavior more natural,
whereas most programmers are used to the "unnatural" vi/emacs behavior.
You can change this setting in the Launcher's settings dialog, under
"Tools" - "Editor" - "ST80 cursor behavior at end of line".
(*) the "Rand-editor, known as e" was a much advanced wysiwyg editor for glass-tube displays.
It was quite popular in the 80's. (http://www.rand.org/pubs/notes/2006/N2239-1.pdf)
By default, ST/X uses tabs of 4 (i.e. at positions 1, 5, 9, ...) for indentation,
which gives a good compromise between line-length and readability
(tabs of 8 typically lead to very long lines, which make the code harder to
read as you might have to scroll horizontally).
Notice, that the tab setting only affect the cursor behavior in the editor.
Externally (i.e. in the file), tabs are always assumed to be in multiples of 8.
When reading a file, leading tabs are converted, and vice versa, when writing
files, leading spaces are converted to tabs in multiples of 8.
Copyright © 1995-2013 Claus Gittinger Development & Consulting, all rights reserved
<cg@exept.de>
Doc $Revision: 1.10 $ $Date: 2017/11/25 13:48:24 $