Creating an auto-complete-enabled prompt with readline-lib #777
Answered
by
mflatt
vinipsmaker
asked this question in
Q&A
|
I'm failing to make The Racket version does work, so I don't understand why the Rhombus version doesn't work: #lang racket
(require readline/readline)
(define (on_completion partial_input)
(set-completion-append-character! #\!)
(filter (lambda (e) (string-prefix? e partial_input))
'("Rudolf" "Hermie" "Bumble" "Yukon" "Clarise" "Santa")))
(set-completion-function! on_completion)
(readline "my-shell> ") |
Answered by
mflatt
Apr 7, 2026
Replies: 1 comment
|
The problem is that a Rhombus list is not a Racket list, and the completion function wrapper doesn't complain about a non-Racket-list result. I'm not sure why the wrapper doesn't complain, but maybe it's because the callback is in atomic mode, so exceptions are unsafe at that point. Adding |
0 replies
Answer selected by
vinipsmaker
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem is that a Rhombus list is not a Racket list, and the completion function wrapper doesn't complain about a non-Racket-list result. I'm not sure why the wrapper doesn't complain, but maybe it's because the callback is in atomic mode, so exceptions are unsafe at that point.
Adding
PairListbefore["Rudolf", ....makes it work.