class BBS::Editor

A full-screen text editor on a telnet line, for a modern terminal and a Commodore 64 alike, for text longer than a BBS::Field holds: the cursor keys move anywhere in the text, typing inserts at the cursor, DEL (backspace) deletes before it, and the text wraps at word boundaries as it is typed. The text and the cursor live in a BBS::TextBuffer, so the editing keys do what they do in a BBS::Field.

The editor owns the screen while it runs: a reversed title bar on the first row, the text below it, and a row of key hints near the bottom. It draws through a BBS::Cursor, which moves only relative to where it left the cursor; it never writes into the last column or the last row, which on a C64 would link or scroll lines.

Keys:

cursor keys

move; up and down keep the column

HOME, END

the start and the end of the screen row

PgUp, PgDn

a screenful up or down

RETURN

a new line; saves in a single-line editor

DEL, backspace

deletes the character before the cursor

Delete

deletes the character under the cursor

RUN/STOP, ←, Esc

asks on the bottom row: S saves, Q quits without saving, any other key goes back to the text

F1, Ctrl-S

saves at once, where the terminal program lets the key through (the Ultimate Term keeps F1 for itself)

text = BBS::Editor.new(session, text: post.body, title: 'BODY').run
post.body = text if text