Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: src/lib/libedit
Module Name: src
Committed By: christos
Date: Sun Jan 18 17:18:37 UTC 2026
Modified Files:
src/lib/libedit: refresh.c
Log Message:
When trying to print a help message while editing a multiline entry, print
move down enough so that the error message does not get printed on top of
the newline from Yuishiro NAITO. Example program:
#include <stdio.h>
#include <histedit.h>
char *
prompt(EditLine *el)
{
return "(config) ";
}
static unsigned char
help(EditLine *el, int ch)
{
printf("\n");
printf("aaa:\n");
printf("bbb:\n");
printf("ccc:\n");
printf("ddd:\n");
return CC_REDISPLAY;
}
int
initialize(EditLine **ret)
{
EditLine *el;
if ((el = el_init("sample", stdin, stdout, stderr)) == NULL)
goto error;
el_set(el, EL_PROMPT, prompt);
el_set(el, EL_EDITOR, "emacs");
el_set(el, EL_ADDFN, "help", "", help);
el_set(el, EL_BIND, "?", "help", NULL);
*ret = el;
return 0;
error:
el_end(el);
*ret = NULL;
return -1;
}
int
main(int argc, char *argv[])
{
EditLine *el;
const wchar_t *cmd;
int len;
if (initialize(&el) < 0) {
printf("initialize failed\n");
return 1;
}
while ((cmd = el_wgets(el, &len)) != NULL) {
printf("ok\n");
}
el_end(el);
return 0;
}
To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/lib/libedit/refresh.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index