readline: Make prompt-caching available

readline cached the current prompt only when TAB completion was enabled,
even though line-editing redraws also depend on that cached prompt.
With TAB completion disabled, full-line redraws erased the prompt and
repainted only the command buffer. Make the prompt cache available
whenever line editing is enabled.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
This commit is contained in:
Alan C. Assis 2026-07-22 09:26:32 +00:00 committed by Alan Carvalho de Assis
parent 6818ec4d22
commit 5779652d3d
3 changed files with 28 additions and 16 deletions

View file

@ -88,8 +88,9 @@ extern "C"
*
* If a prompt string is used by the application, then the application
* must provide the prompt string to readline() by calling this function.
* This is needed only for tab completion in cases where is it necessary
* to reprint the prompt string.
* This is needed for tab completion, and for line editing's full-line
* redraws (Home, End, history recall, ...), in cases where it is
* necessary to reprint the prompt string.
*
* Input Parameters:
* prompt - The prompt string. This function may then be
@ -108,7 +109,7 @@ extern "C"
*
****************************************************************************/
#ifdef CONFIG_READLINE_TABCOMPLETION
#if defined(CONFIG_READLINE_TABCOMPLETION) || defined(CONFIG_READLINE_EDIT)
FAR const char *readline_prompt(FAR const char *prompt);
#else
# define readline_prompt(p)