1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 00:10:27 +00:00

Change Ctrl-C and move old behavior to Ctrl-Q

This lets Janet be a better unix citizen and lets Ctrl-C
raise an interrupt. Trying to make Janet behave superficially
like a shell by overriding Ctrl-C is not helpful.
This commit is contained in:
Calvin Rose 2020-12-29 16:20:37 -06:00
parent cc2cc4db43
commit 27b1f59aa9
3 changed files with 14 additions and 0 deletions

View File

@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## Unreleased - ??? ## 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. - Importing modules that start with `/` is now the only way to import from project root.
Before, this would import from / on disk. Before, this would import from / on disk.
- Change hash function for numbers. - Change hash function for numbers.

View File

@ -64,6 +64,10 @@ Move cursor to the beginning of input line.
.BR Ctrl\-B .BR Ctrl\-B
Move cursor one character to the left. 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 .TP 16
.BR Ctrl\-E .BR Ctrl\-E
Move cursor to the end of input line. Move cursor to the end of input line.
@ -100,6 +104,10 @@ Delete one word before the cursor.
.BR Ctrl\-G .BR Ctrl\-G
Show documentation for the current symbol under the cursor. Show documentation for the current symbol under the cursor.
.TP 16
.BR Ctrl\-Q
Clear the current command, including already typed lines.
.TP 16 .TP 16
.BR Alt\-B/Alt\-F .BR Alt\-B/Alt\-F
Move cursor backwards and forwards one word. Move cursor backwards and forwards one word.

View File

@ -758,6 +758,10 @@ static int line() {
kleft(); kleft();
break; break;
case 3: /* ctrl-c */ case 3: /* ctrl-c */
clearlines();
gbl_sigint_flag = 1;
return -1;
case 17: /* ctrl-q */
gbl_cancel_current_repl_form = 1; gbl_cancel_current_repl_form = 1;
clearlines(); clearlines();
return -1; return -1;