@@ -967,10 +967,15 @@ void recalculate_syntax(line_t * line, int line_no) {
967
967
s -> state .i = 0 ;
968
968
969
969
while (1 ) {
970
+ struct termios old , new ;
971
+ tcgetattr (global_config .tty_in , & old );
972
+ new = old ; new .c_lflag |= ISIG ;
973
+ tcsetattr (global_config .tty_in , TCSAFLUSH , & new );
970
974
ptrdiff_t before = krk_currentThread .stackTop - krk_currentThread .stack ;
971
975
krk_push (OBJECT_VAL (env -> syntax -> krkFunc ));
972
976
krk_push (OBJECT_VAL (s ));
973
977
KrkValue result = krk_callStack (1 );
978
+ tcsetattr (global_config .tty_in , TCSAFLUSH , & old );
974
979
krk_currentThread .stackTop = krk_currentThread .stack + before ;
975
980
if (IS_NONE (result ) && (krk_currentThread .flags & KRK_THREAD_HAS_EXCEPTION )) {
976
981
render_error ("Exception occurred in plugin: %s" , AS_INSTANCE (krk_currentThread .currentException )-> _class -> name -> chars );
@@ -3437,6 +3442,11 @@ void SIGCONT_handler(int sig) {
3437
3442
signal (SIGTSTP , SIGTSTP_handler );
3438
3443
}
3439
3444
3445
+ void SIGINT_handler (int sig ) {
3446
+ krk_currentThread .flags |= KRK_THREAD_SIGNALLED ;
3447
+ signal (SIGINT , SIGINT_handler );
3448
+ }
3449
+
3440
3450
void try_to_center () {
3441
3451
int half_a_screen = (global_config .term_height - 3 ) / 2 ;
3442
3452
if (half_a_screen < env -> line_no ) {
@@ -11127,6 +11137,7 @@ void init_terminal(void) {
11127
11137
signal (SIGWINCH , SIGWINCH_handler );
11128
11138
signal (SIGCONT , SIGCONT_handler );
11129
11139
signal (SIGTSTP , SIGTSTP_handler );
11140
+ signal (SIGINT , SIGINT_handler );
11130
11141
}
11131
11142
11132
11143
struct action_def * find_action (void (* action )()) {
0 commit comments