FEDLINE(1)

NAME
fedline - single-line terminal text editor for shell scripts

SYNOPSIS
fedline row col WIDTH MAXLEN [options]

DESCRIPTION
fedline is a curses-based single-line text editor designed as a subprocess component for shell scripts. It renders a fixed-width input field at the specified screen position, accepts user input, and on exit writes the edited text to stdout and the exit reason to stderr.

The editor always draws only within its field area, over whatever is already on the screen. It never clears or scrolls the surrounding display and cannot restore it on exit — the calling script manages the surrounding display. This makes it suitable for embedding in larger TUI forms.

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. When the text exceeds this width, the viewport scrolls horizontally.

MAXLEN
    Maximum input length in characters. Input is blocked when this limit is reached.

OPTIONS

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

-f, --fill CHAR
    Fill character displayed in unused field positions. When omitted, unused positions show as spaces.

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

-q, --quiet
    Suppress the exit reason mnemonic on stderr. The exit code is still set.

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

-m, --mode MODE
    Initial input mode: ins (insert) or ovr (overwrite). Default: ins. The Insert key toggles between modes at runtime.

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

--color FG,BG
    Field foreground/background colors. Names: black, red, green, yellow, blue, magenta, cyan, white, optionally prefixed with bright-, or default.

-n, --noop
    Display the field with its content and exit immediately with code 0 and reason "NOOP". No editing occurs.

-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
Each exit key produces a mnemonic on stderr and a numeric exit code.

Key | Mnemonic | Code
Escape | ESC | 1
Enter | ENTER | 2
Tab | TAB | 3
Shift+Tab | SHIFT-TAB | 4
F10 | F10 | 5
Up Arrow | UP_TOP | 6
Down Arrow | DOWN_BOTTOM | 7
Page Up | PGUP | 8
Page Down | PGDN | 9

Since fedline is single-line, directional keys (Up, Down, PgUp, PgDn) always meet the boundary condition and trigger exit immediately.

EDITING KEYS
Key | Action
Insert | Toggle insert/overwrite mode
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+Y | Clear all text
Ctrl+Z | Undo last edit
Home | Move cursor to start of text
End | Move cursor to end of text
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).

CAPTURING OUTPUT
tmpf=$(mktemp)
text=$(python3 fedline.py 0 0 40 120 -v "hello" 2>"$tmpf")
code=$?
reason=$(cat "$tmpf"); rm -f "$tmpf"

EXAMPLES
# Basic 40-column field, max 120 chars
python3 fedline.py 0 0 40 120 -v "hello"
# With fill character and restricted exit keys
python3 fedline.py 0 0 40 120 -v "hello" -f "." -e TAB,SHIFT-TAB
# Overwrite mode, cursor at start, reverse video
python3 fedline.py @ @ 40 120 -v "hello" -c start -m ovr -r
# Display-only (no editing)
python3 fedline.py 5 10 30 50 -v "readonly" -n
# Colored field
python3 fedline.py 0 0 40 120 -v "hello" --color yellow,blue

SCROLL INDICATORS
When the field width is at least 5, a < is drawn at the leftmost column whenever content extends off the left edge, and a > is drawn at the rightmost column whenever content extends off the right edge. Indicators overlay the edge character of the viewport; the underlying text and logical cursor position are unchanged.

SEE ALSO
fedarea(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.