[up]

Code Editor

Index

General Introduction

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 the ST/X executable's startup folder or into your private "~/.smalltalk" directory.

Menu Functions

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

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

These are usually CTRL-key combinations.

Selection Keys

These are usually ALT-key combinations, except on systems where these key combinations are already used by the window manager. In this case, other (usually CTRL-key) combinations are used; take a look at the keyboard map in the settings dialog or inspect the "keyboard.rc" file for your concrete setting..

Operation Keys

Code Related Operation Keys

These are highlevel command keys, which are available in editors which show code (eg. in Code Browsers or Workspaces).

Syntax Coloring

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 "System" - "Settings - ""Tools" - "Editor" - "Syntax Colors" dialog.

Code Completion

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.

Snippet Insertion (Abbreviations)

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.

Customization

The behavior can be adjusted via the Launcher's "System"-"Settings"-"Tools"-"Editor" dialog. The settings are kept in "~/.smalltalk/settings.stx" (although it is not good idea to edit it, as it will be overwritten when the settings are saved).

The keyboard map is read upon startup from the "keyboard.rc" file. Advanced users may edit this and adjust to personal preferences.

Hint: there is no need to modify the system's default "keyboard.rc" file, which might be installed in a read-only folder or shared among multiple users. Instead, copy the file to your "~/.smalltalk" folder and edit that file. This folder will be searched before the system folder upon startup.

Cursor Behavior at Line End

The Cursor behavior of the editor can be configured to one of two modes: 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)

Tabulator Positions

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 affects 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.


[stx logo] Copyright © 1995-2018 Claus Gittinger Development & Consulting, all rights reserved

<cg at exept.de>

Doc $Revision: 1.21 $ $Date: 2021/03/13 18:24:52 $