Currently, I get:
?- use_module(library(charsio)). true. ?- get_single_char(C). (press Ctrl-c) C = c.
Expected: Interruption, yielding for example caught: error('$interrupt_thrown',repl).
Is it possible to implement this? One use case is interrupting animations of search processes, where get_single_char/1 is used for intermediate pausing.
Another test case:
?- repeat, get_single_char(C), false.
Currently, it is not possible to interrupt this.
Is it caught: error('$interrupt_thrown',repl)
or caught: error('$interrupt_thrown',get_single_char/1)?
Is it caught: error('$interrupt_thrown',repl)
or caught: error('$interrupt_thrown',get_single_char/1)?
The interrupt is caught by the REPL, typically.
I have an implementation but get_single_char/1 is the one throwing error. Will make a PR for this.
That would be perfect! Thank you a lot!
Brilliantly resolved by @notoria in #460. Many thanks!
queens.pl now works very nicely, piping output to Ghostscript:
$ scryer-prolog -g 'show(20,[ff])' queens.pl | \
gs -dNOPROMPT -g680x680 -dGraphicsAlphaBits=2 -r144 -q
Press any key to show the next solution. And now the animation can be nicely interrupted with Ctrl-c, followed by Ctrl-d to exit the Prolog process. Thank you again!
Most helpful comment
The interrupt is caught by the REPL, typically.