MCPcopy Create free account
hub / github.com/antirez/ds4 / refreshLineWithCompletion

Function refreshLineWithCompletion

linenoise.c:748–773  ·  view source on GitHub ↗

Called by completeLine() and linenoiseShow() to render the current * edited line with the proposed completion. If the current completion table * is already available, it is passed as second argument, otherwise the * function will use the callback to obtain it. * * Flags are the same as refreshLine*(), that is REFRESH_* macros. */

Source from the content-addressed store, hash-verified

746 return ws.ws_col;
747 }
748
749failed:
750 return 80;
751}
752
753/* Clear the screen. Used to handle ctrl+l */
754void linenoiseClearScreen(void) {
755 if (write(STDOUT_FILENO,"\x1b[H\x1b[2J",7) <= 0) {
756 /* nothing to do, just to avoid warning. */
757 }
758}
759
760/* Beep, used for completion when there is nothing to complete or when all
761 * the choices were already shown. */
762static void linenoiseBeep(void) {
763 fprintf(stderr, "\x7");
764 fflush(stderr);
765}
766
767/* ============================== Completion ================================ */
768
769/* Free a list of completion option populated by linenoiseAddCompletion(). */
770static void freeCompletions(linenoiseCompletions *lc) {
771 size_t i;
772 for (i = 0; i < lc->len; i++)
773 free(lc->cvec[i]);
774 if (lc->cvec != NULL)
775 free(lc->cvec);
776}

Callers 2

completeLineFunction · 0.85
linenoiseShowFunction · 0.85

Calls 2

refreshLineWithFlagsFunction · 0.85
freeCompletionsFunction · 0.85

Tested by

no test coverage detected