/* * XXX - there is no way to push external args into this function. */ unsigned char complt(EditLine *el, int ch) { const LineInfo *line; char str[1024]; int len, ret; line = el_line(el); if (line->cursor != line->lastchar) return CC_ERROR; len = line->lastchar - line->buffer; if (len >= 1023) return CC_ERROR; memcpy(str, line->buffer, len); str[len] = '\0'; ret = cmd_complt(str, sizeof(str)); el_push(el, &str[len]); return ret ? CC_ERROR : CC_REDISPLAY; }
const char * EditLineReader::readLine(const char *prompt, const char *input) { _prompt = prompt; el_push(_editLine, input); int n; const char *line = el_gets(_editLine, &n); if (line) history(_history, &_event, H_ENTER, line); return line; }
static int emacs_ctrl_d(EditLine *el, const LineInfo *lf, int ch) { static char delunder[3] = { CTRL('f'), CTRL('h'), '\0' }; if (ch == CTRL('d') && is_emacs_mode(el)) { /* CTRL-D is special */ if (lf->buffer == lf->lastchar) return CC_EOF; if (lf->cursor != lf->lastchar) { /* delete without using ^D */ el_push(el, delunder); /* ^F^H */ return CC_NORM; } } return -1; }