-
Notifications
You must be signed in to change notification settings - Fork 4
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
Weird handling of Ctrl+C #3
Comments
Only set the flag, don't load the library. The startup sequence will do that if the session is interactive. ^C while editing doesn't seem to work. I'm happy to get a PR that fixes this. Otherwise I consider it low priority as there is no point to interrupt editing and the libedit command line editor is the default anyway. |
Thank you for your reply and tips! It feels great to be addressed! :) Do you have any pointers for where I should start looking to fix that? Are there perhaps examples I can take a look (how is this handled with libedit)? Any inspiration would be appreciated. |
The sources are in packages/readline. Libedit won't help you much. The APIs of the two command line editors are quite different. IMO the readline one carries a bit too much history, but true, GNU readline is a more capable editor. libedit can be programmed from Prolog though and can provide command line editing from multiple inputs, for example when using the Fixing will require some knowledge about C and Unix signal handling ... |
Pretty comfortable with C and Unix. I'm not familiar with swipl (handling of signals, building it, etc). I'm guessing I should start by studying this part of the sources? packages-readline/readline4pl.c Line 229 in 24f2dad
|
That is a good start. I'd build the system for debugging so you can see what happens and where the ^C ends up. It is not very hard. See https://www.swi-prolog.org/build/unix.html and CMAKE.md in the topdir (the last fro setting up the debug build). |
Ctrl+C is messed up. See SWI-Prolog/packages-readline#3
When I add the following to my
init.pl
:readline
does get used. However, pressing Ctrl+C doesn't make the shell immediately react. I have to press it again, and then some other key, leaving me with the message:Did I mess something up? What can I do to move this closer to the current behaviour when using editline? Would a PR fixing this be accepted?
The text was updated successfully, but these errors were encountered: