Ticket #470 (new defect)

Opened 2 years ago

Last modified 2 years ago

can't bind commands to capital letters

Reported by: dpercy@… Owned by: divascheme
Priority: major Milestone:
Component: divascheme/divascheme.plt Keywords:
Cc: Version: (1 6)
Racket Version: 5.3

Description

Commands bound to shifted letters, such as Shift+B (push), Shift+M (unmark), and Shift+H (holder), insert a capital letter instead of running the command. As a temporary workaround I've changed my keybindings to use Meta+B, Meta+M, and g for these 3 commands. (Meta+H conflicts with "Help" in the menu bar.)

If this isn't easily fixed it would be nice to at least change the default keybindings.

Change History

Changed 2 years ago by zhenya1007

Yes, I noticed that too. The patch below (I tried to attach, but got "internal track error") "fixes it for me" -- at least in command mode. The patch is against a clone of DYoo's repository on github.

The reason for replacing aug-keymap% with keymap% is that aug-keymap% does not appear to support "?:" in the first argument to the map-function "method." (for example, (keymap:canonicalize-keybinding-string "?:s:h" returns "s:h").

diff --git a/command-keymap.ss b/command-keymap.ss
index 4a4f9b1..e86c6ff 100644
--- a/command-keymap.ss
+++ b/command-keymap.ss
@@ -48,7 +48,7 @@

(define make-command-keymap

(lambda (window-text to-insert-mode to-insert-mode/cmd diva-message diva-question interpreter)

- (let ([command-keymap (make-object keymap:aug-keymap%)])
+ (let ([command-keymap (make-object keymap%)])

(define (make-command-to-argument-mode command title)

(let ([default ""])

@@ -177,7 +177,7 @@

"backspace" "delete" "|"
"`" "\"" "," "'" "<" ">" "/" "\\" "?"
"insert" "colon"

- ,@(map (lambda (ch) (format "s:~a" ch))
+ ,@(map (lambda (ch) (format "?:s:~a" ch))

(string->list "abcdefghijklmnopqrstuvwxyz"))

,@(map string

(string->list "abcdefghijklmnopqrstuvwxyz"))))

diff --git a/diva-preferences.ss b/diva-preferences.ss
index b8de50b..451d358 100644
--- a/diva-preferences.ss
+++ b/diva-preferences.ss
@@ -48,11 +48,11 @@

("y" "diva:redo")
("d" "diva:delete")
("b" "diva:bring")

- ("s:b" "diva:push")
- ("s:x" "diva:exchange")
+ ("?:s:b" "diva:push")
+ ("?:s:x" "diva:exchange")

("m" "diva:mark")

- ("s:m" "diva:unmark")
- ("s:h" "diva:holder")
+ ("?:s:m" "diva:unmark")
+ ("?:s:h" "diva:holder")

("t" "diva:transpose")
("." "diva:find-tag")
("o" "diva:join")

@@ -75,7 +75,7 @@

(append

'(("k" "diva:down")

("i" "diva:up")

- ("s:k" "diva:out")
+ ("?:s:k" "diva:out")

("j" "diva:backward")
("l" "diva:forward")
("a" "diva:younger")

@@ -102,7 +102,7 @@

(append

'(("j" "diva:down")

("e" "diva:up")

- ("s:e" "diva:out")
+ ("?:s:e" "diva:out")

("q" "diva:backward")
("k" "diva:forward")
("`" "diva:younger")

@@ -408,4 +408,4 @@

parent))))



- (set-default-preferences))
\ No newline at end of file
+ (set-default-preferences))

Note: See TracTickets for help on using tickets.