Skip to content

Commit

Permalink
prompt: make a better effort to configure terminal for Readline
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
intelfx committed Jun 15, 2024
1 parent de984e2 commit c4f3f15
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/prompt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit c4f3f15

Please sign in to comment.