[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 your ST/X startup 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.

Operation Keys

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

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


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

<cg@exept.de>

Doc $Revision: 1.11 $ $Date: 2018/10/13 14:29:41 $