FEDAREA(1)

NAME
fedarea - multi-line terminal text editor with word wrap for shell scripts

SYNOPSIS
fedarea row col WIDTH ROWS MAXLEN v_scroll word_wrap [options]

DESCRIPTION
fedarea is a curses-based multi-line text editor designed as a subprocess component for shell scripts. It renders a fixed-size text area at the specified screen position with optional word wrap and vertical scrolling.

On exit it writes the edited text to stdout and the exit reason to stderr. It draws inline, rendering only within its own field area over whatever is already on the screen; it does not clear or scroll the surrounding display.

ARGUMENTS

row Screen row for field placement (0-indexed). Use @ for the current cursor row.

col Screen column for field placement (0-indexed). Use @ for the current cursor column.

WIDTH
    Viewport width in visible columns.

ROWS
    Viewport height in visible rows.

MAXLEN
    Maximum input length in characters.

v_scroll
    Vertical scrolling: 1 to enable, 0 to disable. When disabled, input that would exceed ROWS visual lines is rejected.

word_wrap
    Word wrap mode: 1 for word wrap (break at spaces), 0 for character grid (break at column boundary). Ctrl+W toggles this at runtime.

OPTIONS

-v, --val TEXT
    Initial text value. Defaults to empty.

-e, --exit KEYS
    Comma-separated list of exit key mnemonics. When provided, only listed keys trigger an exit. When omitted, all exit keys are active.

-q, --quiet
    Suppress the exit reason mnemonic on stderr.

-c, --cursor POS
    Initial cursor position: start or end (default: end).

-m, --mode MODE
    Initial input mode: ins (insert) or ovr (overwrite). Default: ins. In overwrite mode, typing replaces the character at the cursor. Newline characters are never overwritten. The Insert key toggles modes at runtime.

-r, --reverse
    Display the field in reverse video.

--color FG,BG
    Field foreground/background colors. ANSI names, optional bright- prefix, or default.

-n, --noop
    Display the field with its content and exit immediately with code 0.

-h  Print brief usage and exit.

--help
    Print full help text and exit.

--version
    Print version and copyright information and exit.

TERMINAL
This field draws inline: it renders only within its own area, over whatever is already on the screen. It does not clear the screen and cannot restore it on exit — the calling script manages the surrounding display. fedform(1) is different: it owns and clears the screen and restores it on exit by default.

While the field is active it runs in raw mode, so Ctrl+C does not interrupt it and flow-control keys (Ctrl+S/Ctrl+Q) are inert; leave the field with a configured exit key.

EXIT KEYS
Key | Condition | Mnemonic | Code
Escape | Always | ESC | 1
Ctrl+X | Always | CTRL-X | 2
Tab | Always | TAB | 3
Shift+Tab | Always | SHIFT-TAB | 4
F10 | Always | F10 | 5
Up Arrow | On top line | UP_TOP | 6
Down Arrow | On bottom line | DOWN_BOTTOM | 7
Page Up | On top line | PGUP | 8
Page Down | On bottom line | PGDN | 9

Up/Down/PgUp/PgDn navigate between lines normally; they only trigger exit when the cursor is already at the boundary. When filtered via --exit, the boundary exit is suppressed but normal navigation still works.

EDITING KEYS
Key | Action
Insert | Toggle insert/overwrite mode
Enter | Insert newline
Backspace | Delete character before cursor
Delete | Delete character at cursor
Ctrl+E | Delete from cursor to end of text
Ctrl+T | Delete from start of text to cursor
Ctrl+K | Clear all text
Ctrl+Y | Delete current line
Ctrl+W | Toggle word wrap mode
Ctrl+Z | Undo last edit
Home/End | Move to start/end of current line
Ctrl+Home | Move to start of text
Ctrl+End | Move to end of text
Up/Down | Move between visual lines
PgUp/PgDn | Move by one page (ROWS lines)
Left/Right | Move cursor one character

OUTPUT

stdout
    The final edited text.

stderr
    The exit reason mnemonic (suppressed by --quiet).

exit code
    0 for --noop, 1-9 for exit keys (see EXIT KEYS).

EXAMPLES
# 40x5 editor, scrolling and word wrap on
python3 fedarea.py 0 0 40 5 500 1 1 -v "hello world"
# Only ESC and Ctrl+X can exit
python3 fedarea.py 2 4 60 10 2000 1 1 -e ESC,CTRL-X
# Overwrite mode, cursor at start, reverse video
python3 fedarea.py @ @ 40 5 500 1 1 -v "edit me" -c start -m ovr -r
# Colored area
python3 fedarea.py 0 0 40 5 500 1 1 -v "hello" --color yellow,blue

SCROLL INDICATORS
When wrapped text exceeds the visible rows (and ROWS ≥ 3, WIDTH ≥ 2), a vertical scrollbar is drawn in the rightmost column: | for the track and # for the thumb. The thumb's position and size reflect the visible window over the full document.

SEE ALSO
fedline(1), fedmask(1), fedlist(1), fedcheck(1), fedradio(1), fedform(1), fedmake(1), fedsay(1), fedbox(1)

AUTHOR
smisco (fed@smisco.biz)

COPYRIGHT
Copyright © 2026 smisco. All rights reserved.