1
0
mirror of https://github.com/janet-lang/janet synced 2025-01-13 00:50:26 +00:00

Simplify and don't replace history for cancelled forms

This commit is contained in:
LouisJackman 2020-05-23 08:36:40 +01:00
parent c3e4cbe950
commit e220f44953
No known key found for this signature in database
GPG Key ID: C83A456999EEBC34

View File

@ -63,8 +63,7 @@ Janet janet_line_getter(int32_t argc, Janet *argv) {
gbl_cancel_current_repl_form = false; gbl_cancel_current_repl_form = false;
// Signal that the user bailed out of the current form // Signal that the user bailed out of the current form
static const char *const msg = "cancel"; result = janet_ckeywordv("cancel");
result = janet_ckeywordv(msg);
} else { } else {
result = janet_wrap_buffer(buf); result = janet_wrap_buffer(buf);
} }
@ -960,16 +959,12 @@ void janet_line_get(const char *p, JanetBuffer *buffer) {
} }
if (line()) { if (line()) {
norawmode(); norawmode();
if (gbl_cancel_current_repl_form) { if (gbl_sigint_flag) {
fputc('\n', out); raise(SIGINT);
} else { } else {
if (gbl_sigint_flag) { fputc('\n', out);
raise(SIGINT);
} else {
fputc('\n', out);
}
return;
} }
return;
} }
fflush(stdin); fflush(stdin);
norawmode(); norawmode();