I'm using linenoise with a c command line style program. The standard way of using linenoise is to do a simple
char* line;
line = linenoise("prompt: ");
// Use the line in the app
free(line);
This presents the prompt, and then the user can enter a line, with great editing capabilities including history and hint management. The software is nice, and the code documentation is pretty good.
What I was wondering is, using the linenoise api, is there a way to "preset" the line buffer so that a default line is displayed and editable by the user? Perhaps using the asynch api?
Linenoise does not have an API function to prefill the input buffer with a default string. The standard usage:
char *line = linenoise("prompt: ");
always starts with an empty buffer for the user to edit. Neither the synchronous nor the asynchronous API provides a way to preset the line buffer.