File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -248,4 +248,6 @@ int64_t basic_capslock(struct basic_ctx* ctx);
248248 *
249249 * @param ctx The interpreter context.
250250 */
251- void sleep_statement (struct basic_ctx * ctx );
251+ void sleep_statement (struct basic_ctx * ctx );
252+
253+ bool basic_esc ();
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ int64_t basic_capslock(struct basic_ctx* ctx)
7070 */
7171bool check_input_in_progress (process_t * proc , void * opaque )
7272{
73- if (kpeek () == 27 && ctrl_held ()) {
73+ if (basic_esc ()) {
7474 return false;
7575 }
7676 return kinput (10240 ) == 0 ;
@@ -344,7 +344,7 @@ void kget_statement(struct basic_ctx* ctx)
344344
345345bool check_sleep_in_progress (process_t * proc , [[maybe_unused ]] void * opaque )
346346{
347- if (kpeek () == 27 && ctrl_held ()) {
347+ if (basic_esc ()) {
348348 return false;
349349 }
350350 return time (NULL ) < proc -> code -> sleep_until ;
Original file line number Diff line number Diff line change @@ -854,13 +854,17 @@ void line_statement(struct basic_ctx* ctx)
854854 statement (ctx );
855855}
856856
857+ bool basic_esc () {
858+ return (kpeek () == 27 && ctrl_held ());
859+ }
860+
857861void basic_run (struct basic_ctx * ctx )
858862{
859863 if (basic_finished (ctx )) {
860864 return ;
861865 }
862866 /* TODO Make sure this only runs for foreground processes! */
863- if (kpeek () == 27 && ctrl_held () && !ctx -> errored ) {
867+ if (basic_esc () && !ctx -> errored ) {
864868 (void )kgetc ();
865869 tokenizer_error_print (ctx , "Escape" );
866870 }
Original file line number Diff line number Diff line change 1616 */
1717bool check_sockread_ready (process_t * proc , void * ptr ) {
1818 int64_t fd = (int64_t )(uintptr_t )ptr ;
19- if (kpeek () == 27 && ctrl_held ()) {
19+ if (basic_esc ()) {
2020 return false;
2121 }
2222 return !sock_ready_to_read ((int )fd );
You can’t perform that action at this time.
0 commit comments