Lines Matching defs:el

55 #include "el.h"
84 read_init(EditLine *el)
88 if ((el->el_read = el_malloc(sizeof(*el->el_read))) == NULL)
91 ma = &el->el_read->macros;
98 el->el_read->read_char = read_char;
101 read_end(el);
109 read_end(EditLine *el)
112 read_clearmacros(&el->el_read->macros);
113 el_free(el->el_read->macros.macro);
114 el->el_read->macros.macro = NULL;
115 el_free(el->el_read);
116 el->el_read = NULL;
209 el_wpush(EditLine *el, const wchar_t *str)
211 struct macros *ma = &el->el_read->macros;
219 terminal_beep(el);
220 terminal__flush(el);
230 read_getcmd(EditLine *el, el_action_t *cmdnum, wchar_t *ch)
236 if (el_wgetc(el, ch) != 1)
241 el->el_state.metanext = 0;
247 if (el->el_state.metanext) {
248 el->el_state.metanext = 0;
254 cmd = el->el_map.current[(unsigned char) *ch];
257 switch (keymacro_get(el, ch, &val)) {
262 el_wpush(el, val.str);
267 EL_ABORT((el->el_errfile, "Bad XK_ type \n"));
279 read_char(EditLine *el, wchar_t *cp)
282 int tried = (el->el_flags & FIXIO) == 0;
288 el->el_signal->sig_no = 0;
289 while ((num_read = read(el->el_infd, cbuf + cbp, (size_t)1)) == -1) {
291 switch (el->el_signal->sig_no) {
293 el_wset(el, EL_REFRESH);
296 sig_set(el);
301 if (!tried && read__fixio(el->el_infd, e) == 0) {
380 el_wgetc(EditLine *el, wchar_t *cp)
382 struct macros *ma = &el->el_read->macros;
385 terminal__flush(el);
405 if (tty_rawmode(el) < 0)/* make sure the tty is set up correctly */
408 num_read = (*el->el_read->read_char)(el, cp);
416 el->el_read->read_errno = errno;
422 read_prepare(EditLine *el)
424 if (el->el_flags & HANDLE_SIGNALS)
425 sig_set(el);
426 if (el->el_flags & NO_TTY)
428 if ((el->el_flags & (UNBUFFERED|EDIT_DISABLED)) == UNBUFFERED)
429 tty_rawmode(el);
433 el_resize(el);
434 re_clear_display(el); /* reset the display stuff */
435 ch_reset(el);
436 re_refresh(el); /* print the prompt */
438 if (el->el_flags & UNBUFFERED)
439 terminal__flush(el);
443 read_finish(EditLine *el)
445 if ((el->el_flags & UNBUFFERED) == 0)
446 (void) tty_cookedmode(el);
447 if (el->el_flags & HANDLE_SIGNALS)
448 sig_clr(el);
452 noedit_wgets(EditLine *el, int *nread)
454 el_line_t *lp = &el->el_line;
457 while ((num = (*el->el_read->read_char)(el, lp->lastchar)) == 1) {
459 !ch_enlargebufs(el, (size_t)2))
462 if (el->el_flags & UNBUFFERED ||
476 el_wgets(EditLine *el, int *nread)
487 el->el_read->read_errno = 0;
489 if (el->el_flags & NO_TTY) {
490 el->el_line.lastchar = el->el_line.buffer;
491 return noedit_wgets(el, nread);
495 if (el->el_tty.t_mode == EX_IO && el->el_read->macros.level < 0) {
498 (void) ioctl(el->el_infd, FIONREAD, &chrs);
500 if (tty_rawmode(el) < 0) {
509 if ((el->el_flags & UNBUFFERED) == 0)
510 read_prepare(el);
512 if (el->el_flags & EDIT_DISABLED) {
513 if ((el->el_flags & UNBUFFERED) == 0)
514 el->el_line.lastchar = el->el_line.buffer;
515 terminal__flush(el);
516 return noedit_wgets(el, nread);
521 if (read_getcmd(el, &cmdnum, &ch) == -1)
523 if ((size_t)cmdnum >= el->el_map.nfunc) /* BUG CHECK command */
527 el->el_state.thiscmd = cmdnum;
528 el->el_state.thisch = ch;
529 if (el->el_map.type == MAP_VI &&
530 el->el_map.current == el->el_map.key &&
531 el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) {
533 el->el_chared.c_redo.pos != el->el_chared.c_redo.buf
534 && iswprint(el->el_chared.c_redo.pos[-1]))
535 el->el_chared.c_redo.pos--;
537 *el->el_chared.c_redo.pos++ = ch;
539 retval = (*el->el_map.func[cmdnum]) (el, ch);
542 el->el_state.lastcmd = cmdnum;
547 re_refresh_cursor(el);
551 re_clear_lines(el);
552 re_clear_display(el);
556 re_refresh(el);
560 re_refresh(el);
561 terminal_beep(el);
572 if ((el->el_flags & UNBUFFERED) == 0)
575 *el->el_line.lastchar++ = CONTROL('d');
576 el->el_line.cursor = el->el_line.lastchar;
582 num = (int)(el->el_line.lastchar - el->el_line.buffer);
587 re_clear_display(el); /* reset the display stuff */
588 ch_reset(el); /* reset the input pointers */
589 read_clearmacros(&el->el_read->macros);
590 re_refresh(el); /* print the prompt again */
595 terminal_beep(el);
596 terminal__flush(el);
599 el->el_state.argument = 1;
600 el->el_state.doingarg = 0;
601 el->el_chared.c_vcmd.action = NOP;
602 if (el->el_flags & UNBUFFERED)
606 terminal__flush(el); /* flush any buffered output */
608 if ((el->el_flags & UNBUFFERED) == 0) {
609 read_finish(el);
612 *nread = (int)(el->el_line.lastchar - el->el_line.buffer);
617 if (el->el_read->read_errno)
618 errno = el->el_read->read_errno;
622 return el->el_line.buffer;