SD Core Solo for Windows WS2.0-0

SD TCL - The edit Screen Editor

Microsoft Edit, a menu bar and a dozen keys — the one to reach for when you just want to change a record.

edit {dict} file record

edit opens a record in Microsoft Edit, a small full-screen editor that ships with Windows. It has a menu bar, the shortcuts everyone already knows, and nothing else to learn. That is the point of it: if you want to fix a line in a record and get on with your day, this is the one.

(nano, a second name for edit, was removed in 2.0-0.)

It has no syntax highlighting and no command language. For SD BASIC source — or for anything where you want highlighting, split windows, or a command bar — use micro instead. For a session with no terminal, or one you are driving from a script, use ed.

SD folds case, so a command may be typed in either case. Commands are shown here in lower case. In the tables, italics mark something you supply and bold marks a word typed as it stands; braces mark an optional part.

The keys below are Microsoft Edit's own, for the version SD ships — 1.2.1. SD installs that editor and calls it; it does not implement it, so where a binding differs the editor is right.

Both editors come with SD#

You do not install anything. Both editors are in %USERPROFILE%\SDCoreSolo\usr\bin — edit.exe is Microsoft Edit 1.2.1 and micro.exe is micro 2.0.15 — and the installer needs nothing from the internet to put them there.

The keys#

Ctrl-S saves and Ctrl-Q quits. Those two are most of what anyone needs.

Ctrl-S save
Ctrl-Q exit
Ctrl-W close the file
Ctrl-O · Ctrl-N open a file · new file
Ctrl-Z · Ctrl-Y undo · redo
Ctrl-X · Ctrl-C · Ctrl-V cut · copy · paste
Ctrl-A select all
Ctrl-F · Ctrl-R find · replace
Ctrl-G go to line:column
Ctrl-P go to file
Alt-Z toggle word wrap

The menu bar is the help. There is no help screen — the Help menu holds only About — and there does not need to be one: F10 or Alt and the menu's letter opens a menu, and every command is listed there with its shortcut printed beside it.

Alt-F File
Alt-E Edit
Alt-V View
Alt-H Help

Save As is on the File menu and is the one common command with no shortcut of its own: Alt-F then A.

What SD does around the editor#

The two screen editors are one SD program with two names, so everything in this section is equally true of micro.

the working copy the record is copied into $hold as record.editing, and the editor is run on that. It is removed on every exit, including the ones that fail
saving "Save? <Y>es, <N>o", then for a bp record "Compile?" and "Catalog?"
a dict record is always saved and re-compiled with compile.dict
finishing "<E>xit or <R>e-edit", so a compile error can be fixed without starting again

A compiled dictionary record is truncated to its first 15 fields while you edit it, which is what you want: the fields after them are the compiled form, and compile.dict rebuilds them when you save.

Marks, and how to type one#

A field mark is a line break, so a text editor handles fields on its own. The other three marks are single control characters an editor would either draw as a stray glyph or drop, so each has a token you type instead.

Every token is ~ and one more character, and ~ is the only escape character.

~~ a value mark
~` a subvalue mark
~! a text mark
~- a literal ~, where one would otherwise be misread
~, a literal ,, where one would otherwise read as a separator

SMITH~~JONES~~BROWN is a three-value field; RED~`BLUE~~GREEN is two values, the first with two subvalues.

Marks in a row are separated by a comma#

Written token against token a run of marks cannot be read, so SD puts a comma between them. A text mark, a text mark and a value mark, one after another, is:

~!,~!,~~

Type the comma yourself when you enter marks in a row. It is a separator and not data — which is why a literal comma standing in exactly that position, between two marks, is written ~,.

The conversion is lossless#

No record is refused and none is mangled, whatever it contains. A tilde is written ~- only where the character after it would make the pair look like a token — another ~, a backtick, a !, a -, a ,, or a mark. Everywhere else a tilde is left exactly as you wrote it, so a~b is still a~b and ordinary source reads normally.

The OS switch, and one condition#

On Solo both editors need the os switch. An editor runs outside SD, as your Windows user, so it is a way out of SD like OS.EXECUTE: the switch is off as delivered, and the administrator turns it on with set.os.access os on (the installer asks too). The administrator passes it after admin. Without it the verb says that it needs OS.EXECUTE permission and names the command; nothing is written. ed, the line editor, needs none of this. See Operating system access in the GettingStarted set. (The multiuser SD Core for Windows gates them with a permission an administrator grants per account; on Solo the one account has the switch.)

The condition is a terminal. A session with no terminal is refused before anything is written — an API session, or a script driving SD down a pipe:

:edit bp zzed
edit needs a terminal to draw on, and this session has none.
ed, the line editor, works anywhere.

Both usage errors name the verb you typed rather than the program behind it:

:edit
No file name specified.  Usage: edit {dict} <file> <record>
:edit bp
No record name specified.  Usage: edit {dict} <file> <record>

Who has these verbs#

Your account has edit, micro and ed. ed always runs, and works with no terminal at all. edit and micro run outside SD, so they are behind the os switch, off as delivered and turned on by the administrator with set.os.access os on (see The OS switch, and one condition above).

See also#

SD TCL - The micro Screen Editor · SD TCL - The ed Line Editor · SD TCL - Files and Records.