我想重新绑定
C-up
到"M-p : bring the previously entered expression down to the prompt"
和
C-down
到"M-n : bring the expression after the current expression in the expression history down to the prompt"
Racket的行为与我的默认终端不同,在默认终端中,我可以使用这些控件绑定来滚动以前的表达式。racket 手册给出了一些重新绑定的例子,但没有解释如何仅在交互窗口中重新绑定密钥,这正是这里所需要的。它所做的是保持C-up & C-down的相同绑定,这意味着向上和向下移动光标,就像在编辑器窗口和交互提示符中有用的那样。但我想我不想那样,因为我看不出它的用途。
发布于 2019-10-17 09:37:01
这是我自己用的东西。你可以随意调整它:
#lang s-exp framework/keybinding-lang
(require drracket/tool-lib)
(define (register-repl key command command-fallback)
(keybinding key (λ (ed evt)
(define canvas (send ed get-canvas))
(send (send ed get-keymap) call-function
(if (is-a? canvas drracket:unit:interactions-canvas%)
command
command-fallback)
ed evt #t))))
(register-repl "d:up" "put-previous-sexp" "beginning-of-file")
(register-repl "d:down" "put-next-sexp" "end-of-file")
https://stackoverflow.com/questions/58428629
复制相似问题