softline is a C89 multiline prompt editor derived from linenoise.
It is meant for shells, chat prompts, REPLs, and other readline-like
interfaces where Enter submits and Ctrl-J inserts a newline.
The project is a handle-oriented editor core. It is usable for simple
multiline prompts and bounded bottom-prompt interfaces, but it is not a
complete GNU Readline replacement and does not provide Readline API or ABI
compatibility. The current-state and gap spec lives in docs/softline-spec.md.
The public API is handle based. Use a constructor to create an sl_t, call
methods on that receiver for instance behavior, and destroy it when done. Each
handle owns its own line buffer, history, terminal state, render cache, and
callbacks; softline keeps no global editor state.
#include "softline/softline.h"
sl_t *sl = sl_create();
char *line = sl->readline(sl, "softline> ");
if (line) {
sl->history_add(sl, line);
sl->free_string(sl, line);
} else if (sl->last_readline_status(sl) == SL_READLINE_EOF) {
/* input ended */
}
sl->destroy(sl);
See github.com/sa6mwa/softline for more information.