diff --git a/CHANGELOG.md b/CHANGELOG.md index 4288299f..a2f4ad58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. ## Unreleased - ??? +- Change repl behavior to make Ctrl-C raise SIGINT on posix. The old behavior for Ctrl-C, + to clear the current line buffer, has been moved to Ctrl-Q. - Importing modules that start with `/` is now the only way to import from project root. Before, this would import from / on disk. - Change hash function for numbers. diff --git a/janet.1 b/janet.1 index 61c65b64..e25989e2 100644 --- a/janet.1 +++ b/janet.1 @@ -64,6 +64,10 @@ Move cursor to the beginning of input line. .BR Ctrl\-B Move cursor one character to the left. +.TP 16 +.BR Ctrl\-D +If on a newline, indicate end of stream and exit the repl. + .TP 16 .BR Ctrl\-E Move cursor to the end of input line. @@ -100,6 +104,10 @@ Delete one word before the cursor. .BR Ctrl\-G Show documentation for the current symbol under the cursor. +.TP 16 +.BR Ctrl\-Q +Clear the current command, including already typed lines. + .TP 16 .BR Alt\-B/Alt\-F Move cursor backwards and forwards one word. diff --git a/src/mainclient/shell.c b/src/mainclient/shell.c index 53c73b6d..174a324f 100644 --- a/src/mainclient/shell.c +++ b/src/mainclient/shell.c @@ -758,6 +758,10 @@ static int line() { kleft(); break; case 3: /* ctrl-c */ + clearlines(); + gbl_sigint_flag = 1; + return -1; + case 17: /* ctrl-q */ gbl_cancel_current_repl_form = 1; clearlines(); return -1;