[plt-scheme] vi mode and editor questions

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sat Nov 22 19:40:36 EST 2008

On Sat, Nov 22, 2008 at 4:32 PM, Jon Rafkind <workmin at ccs.neu.edu> wrote:
> Oh yea, sorry. So when I press control I get an event that has the key code
> as 'control'. But shouldn't the get-control-down be #t in this case? What I
> want is to be able to press ctrl-d and have (get-control-down) be #t and
> (get-key-code) be #\d.

When I do the experiment myself (code below) I get what you seem to
want. I'm on a mac tho, and I don't have a linux machine handy to
test. So, I'm not sure what the right answer is. Matthew would
probably know better, but maybe a first step is for you to try the


#lang scheme/gui

(define t%
  (class text%
    (define/override (on-char evt)
      (printf "key-code ~s control ~s\n"
              (send evt get-key-code)
              (send evt get-control-down))
      (super on-char evt))

(define f (new frame% [label ""] [width 200] [height 200]))
(define t (new t%))
(define ec (new editor-canvas% [parent f] [editor t]))
(send ec focus)
(send f show #t)

Posted on the users mailing list.