[plt-scheme] vi mode and editor questions

From: Geoffrey S. Knauth (geoff at knauth.org)
Date: Sun Nov 23 05:14:28 EST 2008

Given a bookshelf at work fell on my MacBook Pro, my Ubuntu 8.10 machine
running [3m] is happy to test Robby's code.  This
is what I get when I press C-d:

  key-code #\d control #t


-----Previous Context-----
from: Robby Findler <robby at cs.uchicago.edu>
to: Jon Rafkind <workmin at ccs.neu.edu>
cc: PLT-list <plt-scheme at list.cs.brown.edu>

> ... 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)
Geoffrey S. Knauth | http://knauth.org/gsk

Posted on the users mailing list.