[racket] How to check if a key is pressed within interaction block, and not declaration one.
When you say "crashes Dr. Racket", what do you mean? (What is the
precise error message?)
Are you using this as a keybinding file?
On Wed, Jul 11, 2012 at 3:02 PM, Oleg Gunkin <oleg.gunkin at gmail.com> wrote:
> Basically, I want to change up/down key behaviour within interaction
> window to "put-next-sexp"/ "put-previous-sexp" instead moving the
> cursor, but only for interaction block.
>
> This is what I came up with:
>
> (require drracket/tool-lib)
>
> (define (rebind key function original-function)
> (keybinding
> key
> (lambda (editor event)
> (send
> (send editor get-keymap)
> call-function
> (if (is-a? editor drracket:rep:text<%>)
> function
> original-function)
> editor event #t))))
>
> (rebind "down" "put-next-sexp" "next-line")
> (rebind "up" "put-previous-sexp" "previous-line")
>
> However, (is-a? editor drracket:rep:text<%>) together with (require
> drracket/tool-lib) crashes Dr. Racket. Is there an alternative way to
> do this?
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users