Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGINT handling on multiline PS1 #202

Open
cubernetes opened this issue Apr 14, 2024 · 0 comments
Open

SIGINT handling on multiline PS1 #202

cubernetes opened this issue Apr 14, 2024 · 0 comments

Comments

@cubernetes
Copy link

cubernetes commented Apr 14, 2024

Sending an interrupt signal to mrsh while having a multline prompt redraws the prompt incorrectly:

PS1="$(printf 'line1\nline2: ')" ./mrsh
line1
line2: ^C
line2:

One way that seems to work is to add rl_reset_line_state() before rl_replace_line() in sigint_handler.

Another hacky way is to set the readline variable rl_event_hook to a no-op function (e.g. static int no_op(void) { return 0; }) and when handling the signal interrupt (in static void sigint_handler()), the only thing you do is set the readline variable rl_done to 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant