Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions linenoise.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ enum KEY_ACTION{
};

static void linenoiseAtExit(void);
int linenoiseWasInterrupted = 0;
int linenoiseHistoryAdd(const char *line);
#define REFRESH_CLEAN (1<<0) // Clean the old prompt from the screen
#define REFRESH_WRITE (1<<1) // Rewrite the prompt on the screen.
Expand Down Expand Up @@ -964,6 +965,7 @@ char *linenoiseEditFeed(struct linenoiseState *l) {
return strdup(l->buf);
case CTRL_C: /* ctrl-c */
errno = EAGAIN;
linenoiseWasInterrupted = 1;
return NULL;
case BACKSPACE: /* backspace */
case 8: /* ctrl-h */
Expand Down
1 change: 1 addition & 0 deletions linenoise.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ extern "C" {

#include <stddef.h> /* For size_t. */

extern int linenoiseWasInterrupted; /* nonzero if last keystroke was ctrl-c */
extern char *linenoiseEditMore;

/* The linenoiseState structure represents the state during line editing.
Expand Down