From c4f3f1547aca57d93f3071dae0b198cdb0e58c87 Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov Date: Sat, 15 Jun 2024 04:53:19 +0200 Subject: [PATCH] prompt: make a better effort to configure terminal for Readline This fixes ^C behavior within the Readline prompt. This does _not_ implement any sane ESC handling, nor does it seem to handle ^C after an outstanding ESC. Still better than nothing. --- src/prompt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/prompt.c b/src/prompt.c index 7463d46cb..4c71d5213 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -499,8 +499,10 @@ read_prompt(const char *prompt) curs_set(1); if (signal(SIGINT, sigint_absorb_handler) == SIG_ERR) die("Failed to setup sigint handler"); + noraw(); cbreak(); line = readline(prompt); + nocbreak(); raw(); if (signal(SIGINT, SIG_DFL) == SIG_ERR) die("Failed to remove sigint handler");