fgof-lineedit Public
Go to file
T
Code
Use Git or checkout with SVN using the web URL.
No matching headings.
fgof-lineedit
Fortran-native line editing helpers for interactive CLI tools.
fgof-lineedit is intended to be a small, standalone library that gives Fortran shells, REPLs, and interactive CLIs a friendlier editing surface than raw terminal reads.
It is part of the FortranGoingOnForty lib-modules catalog, but it is intended to stand on its own as a normal fpm package.
Current v1 target:
- editable line buffer and cursor model
- prompt handling and rendered line state
- history navigation and history storage hooks
- completion and key-handling integration points
- clean boundaries with future
fgof-termiosandfgof-keys
Future scope:
- richer readline-style editing commands
- completion engines and menu UIs
- prompt widgets and multi-line editing
Status
Initial scaffold is in place.
Implemented today:
- public
fgof_lineeditandfgof_lineedit_typesmodules - line editor, action, completion, history, prompt, and render-state types
- prompt constructor, editable buffer core, cursor movement and deletion helpers, word-wise navigation, history navigation, action dispatch, completion helpers, completion-menu state, accept helpers, and render snapshots
- smoke-test coverage and CI wiring
Still to implement:
- terminal integration and redraw policy
- richer completion menus and callback policies
Why Use It
- line editing is repeatedly hand-built in shells, REPLs, and text tools
- the Fortran ecosystem still lacks an obvious small default package here
- it is meant to compose cleanly with
fgof-pty, futurefgof-termios, and futurefgof-keys
Public API Shape
Primary modules:
fgof_lineeditfgof_lineedit_types
Public types:
completion_itemcompletion_spanlineedit_actionlineedit_render_completionlineedit_render_statelineedit_stateprompt_spechistory_entry
Action constants:
FGOF_LINEEDIT_ACT_NONEFGOF_LINEEDIT_ACT_INSERTFGOF_LINEEDIT_ACT_DELETE_LEFTFGOF_LINEEDIT_ACT_DELETE_RIGHTFGOF_LINEEDIT_ACT_DELETE_WORD_LEFTFGOF_LINEEDIT_ACT_DELETE_WORD_RIGHTFGOF_LINEEDIT_ACT_MOVE_LEFTFGOF_LINEEDIT_ACT_MOVE_RIGHTFGOF_LINEEDIT_ACT_MOVE_WORD_LEFTFGOF_LINEEDIT_ACT_MOVE_WORD_RIGHTFGOF_LINEEDIT_ACT_MOVE_HOMEFGOF_LINEEDIT_ACT_MOVE_ENDFGOF_LINEEDIT_ACT_HISTORY_PREVIOUSFGOF_LINEEDIT_ACT_HISTORY_NEXT
Current public procedures:
accept_lineadd_history_entryapply_completionapply_selected_completionapply_actionbuffer_lengthclear_completion_menucompletion_countcompletion_span_at_cursordelete_word_leftdelete_word_rightset_bufferset_completion_itemsinsert_textinsert_actiondelete_leftdelete_rightdefault_prompthistory_counthistory_previoushistory_nextinit_lineeditmove_cursor_leftmove_cursor_rightmove_cursor_word_leftmove_cursor_word_rightmove_cursor_homemove_cursor_endlineedit_completion_providerrender_lineeditrefresh_completion_menureset_lineeditselect_next_completionselect_previous_completionsimple_action
Quick Start
program demo_lineedit
use fgof_lineedit, only : &
default_prompt, &
init_lineedit, &
lineedit_render_state, &
lineedit_state, &
render_lineedit, &
set_buffer
implicit none
type(lineedit_state) :: editor
type(lineedit_render_state) :: view
call init_lineedit(editor, default_prompt("> "))
call set_buffer(editor, "build", 3)
view = render_lineedit(editor)
print "(A)", view%line
print "(I0)", view%cursor_column
end program demo_lineedit
Build And Test
fpm test
That is the baseline verification command locally and in CI.
Supported Platforms
- macOS
- Linux
Boundaries
- intended to stay independently versioned and releasable
- focused on editing state and library ergonomics, not full shell implementation
- terminal-mode control should stay in a future companion package
Notes
lineedit_stateis a public Fortran type, so callers can mutate fields directly. The helper procedures are the safer path when you want cursor, history, completion, and render-state invariants to stay aligned.
License
MIT