src/cforth/linenoise.c
int linenoiseEditInsert(struct linenoiseState *l, char c) {
    if (l->len < l->buflen) {
        if (l->len == l->pos) {
            l->buf[l->pos] = c;
            l->pos++;
            l->len++;
            l->buf[l->len] = '\0';
            if ((!mlmode && l->plen+l->len < l->cols) /* || mlmode */) {
                /* Avoid a full update of the line in the
                 * trivial case. */
		write_console(&c, 1);
            } else {
                refreshLine(l);
            }
        } else {
            memmove(l->buf+l->pos+1,l->buf+l->pos,l->len-l->pos);
            l->buf[l->pos] = c;
            l->len++;
            l->pos++;
            l->buf[l->len] = '\0';
            refreshLine(l);
        }
    }
    return 0;
}
/* Insert the character 'c' at cursor current position.
 *
 * On error writing to the terminal -1 is returned, otherwise 0. */
Insert the character 'c' at cursor current position.
On error writing to the terminal -1 is returned, otherwise 0.
Insert the character ' c ' at cursor current position . On error writing to the terminal - 1 is returned otherwise 0 .
int linenoiseEditInsert(struct linenoiseState *l, char c) {
    if (l->len < l->buflen) {
        if (l->len == l->pos) {
            l->buf[l->pos] = c;
            l->pos++;
            l->len++;
            l->buf[l->len] = '\0';
            if ((!mlmode && l->plen+l->len < l->cols) ) {
		write_console(&c, 1);
            } else {
                refreshLine(l);
            }
        } else {
            memmove(l->buf+l->pos+1,l->buf+l->pos,l->len-l->pos);
            l->buf[l->pos] = c;
            l->len++;
            l->pos++;
            l->buf[l->len] = '\0';
            refreshLine(l);
        }
    }
    return 0;
}
int linenoiseEditInsert ( struct linenoiseState * l , char c ) { if ( l -> len < l -> buflen ) { if ( l -> len == l -> pos ) { l -> buf [ l -> pos ] = c ; l -> pos ++ ; l -> len ++ ; l -> buf [ l -> len ] = ' \0 ' ; if ( ( ! mlmode && l -> plen + l -> len < l -> cols ) ) { write_console ( & c , 1 ) ; } else { refreshLine ( l ) ; } } else { memmove ( l -> buf + l -> pos + 1 , l -> buf + l -> pos , l -> len - l -> pos ) ; l -> buf [ l -> pos ] = c ; l -> len ++ ; l -> pos ++ ; l -> buf [ l -> len ] = ' \0 ' ; refreshLine ( l ) ; } } return 0 ; }
Insert the character 'c' at cursor current position.
Insert the character ' c ' at cursor current position .
/* || mlmode */ /* Avoid a full update of the line in the
                 * trivial case. */