adjust make-meta-prefix-list and keymap:send-map-function-meta
to only add ~c: when asked to (and then asked them to do it a bunch)
This commit is contained in:
parent
ec80b7d01c
commit
a8473ec1aa
|
@ -1168,10 +1168,14 @@
|
||||||
|
|
||||||
(proc-doc/names
|
(proc-doc/names
|
||||||
keymap:make-meta-prefix-list
|
keymap:make-meta-prefix-list
|
||||||
(string? . -> . (listof string?))
|
(->* (string?) (boolean?) (listof string?))
|
||||||
(key)
|
((key)
|
||||||
|
((mask-control? #f)))
|
||||||
@{This prefixes a key with all of the different meta prefixes and returns a
|
@{This prefixes a key with all of the different meta prefixes and returns a
|
||||||
list of the prefixed strings.
|
list of the prefixed strings. If @racket[mask-control?] is @racket[#t],
|
||||||
|
then the result strings include @racket["~c:"] in them
|
||||||
|
(see @racket[keymap:send-map-function-meta]) for a fuller discussion of this
|
||||||
|
boolean).
|
||||||
|
|
||||||
Takes a keymap, a base key specification, and a function name; it prefixes
|
Takes a keymap, a base key specification, and a function name; it prefixes
|
||||||
the base key with all ``meta'' combination prefixes, and installs the new
|
the base key with all ``meta'' combination prefixes, and installs the new
|
||||||
|
@ -1181,8 +1185,9 @@
|
||||||
|
|
||||||
(proc-doc/names
|
(proc-doc/names
|
||||||
keymap:send-map-function-meta
|
keymap:send-map-function-meta
|
||||||
((is-a?/c keymap%) string? string? . -> . void?)
|
(->* ((is-a?/c keymap%) string? string?) (boolean?) void?)
|
||||||
(keymap key func)
|
((keymap key func)
|
||||||
|
((mask-control? #f)))
|
||||||
@{@index{Meta} Most keyboard and mouse mappings are inserted into a keymap by
|
@{@index{Meta} Most keyboard and mouse mappings are inserted into a keymap by
|
||||||
calling the keymap's @method[keymap% map-function] method. However,
|
calling the keymap's @method[keymap% map-function] method. However,
|
||||||
``meta'' combinations require special attention. The @racket["m:"] prefix
|
``meta'' combinations require special attention. The @racket["m:"] prefix
|
||||||
|
@ -1191,7 +1196,16 @@
|
||||||
combinations can also be accessed by using ``ESC'' as a prefix.
|
combinations can also be accessed by using ``ESC'' as a prefix.
|
||||||
|
|
||||||
This procedure binds all of the key-bindings obtained by prefixing
|
This procedure binds all of the key-bindings obtained by prefixing
|
||||||
@racket[key] with a meta-prefix to @racket[func] in @racket[keymap].})
|
@racket[key] with a meta-prefix to @racket[func] in @racket[keymap].
|
||||||
|
|
||||||
|
If @racket[mask-control?] is @racket[#t],
|
||||||
|
then the result strings include @racket["~c:"] in them.
|
||||||
|
This is important under Windows where international keyboards
|
||||||
|
often require characters that are unmodified on US keyboards to
|
||||||
|
be typed with the AltGr key; such keys come into the system as
|
||||||
|
having both the control and the meta modified applied to them and,
|
||||||
|
generally speaking, keybindings should not change the behavior of
|
||||||
|
those keys.})
|
||||||
|
|
||||||
(proc-doc/names
|
(proc-doc/names
|
||||||
keymap:setup-editor
|
keymap:setup-editor
|
||||||
|
|
|
@ -320,16 +320,17 @@
|
||||||
;;;;;;; ;;;;;;;;
|
;;;;;;; ;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(define (make-meta-prefix-list key)
|
(define (make-meta-prefix-list key [mask-control? #f])
|
||||||
(list (if (regexp-match #rx"(?:^|:)c:" key)
|
(list (if mask-control?
|
||||||
(string-append "m:" key)
|
(string-append "m:" key)
|
||||||
(string-append "~c:m:" key))
|
(string-append "~c:m:" key))
|
||||||
(string-append "ESC;" key)))
|
(string-append "ESC;" key)))
|
||||||
|
|
||||||
(define send-map-function-meta
|
(define (send-map-function-meta keymap key func [mask-control? #f])
|
||||||
(λ (keymap key func)
|
(for ([key (in-list (make-meta-prefix-list key mask-control?))])
|
||||||
(for-each (λ (key) (send keymap map-function key func))
|
(send keymap map-function key func)))
|
||||||
(make-meta-prefix-list key))))
|
|
||||||
|
(define has-control-regexp #rx"(?:^|:)c:")
|
||||||
|
|
||||||
(define add-to-right-button-menu (make-parameter void))
|
(define add-to-right-button-menu (make-parameter void))
|
||||||
(define add-to-right-button-menu/before (make-parameter void))
|
(define add-to-right-button-menu/before (make-parameter void))
|
||||||
|
@ -1041,7 +1042,8 @@
|
||||||
(let* ([map (λ (key func)
|
(let* ([map (λ (key func)
|
||||||
(send kmap map-function key func))]
|
(send kmap map-function key func))]
|
||||||
[map-meta (λ (key func)
|
[map-meta (λ (key func)
|
||||||
(send-map-function-meta kmap key func))]
|
(send-map-function-meta kmap key func
|
||||||
|
(regexp-match has-control-regexp key)))]
|
||||||
[add (λ (name func)
|
[add (λ (name func)
|
||||||
(send kmap add-function name func))]
|
(send kmap add-function name func))]
|
||||||
[add-m (λ (name func)
|
[add-m (λ (name func)
|
||||||
|
@ -1346,8 +1348,9 @@
|
||||||
(λ (kmap)
|
(λ (kmap)
|
||||||
(let* ([map (λ (key func)
|
(let* ([map (λ (key func)
|
||||||
(send kmap map-function key func))]
|
(send kmap map-function key func))]
|
||||||
[map-meta (λ (key func)
|
[map-meta (λ (key func mask-control?)
|
||||||
(send-map-function-meta kmap key func))]
|
(send-map-function-meta kmap key func
|
||||||
|
(regexp-match has-control-regexp key)))]
|
||||||
[add (λ (name func)
|
[add (λ (name func)
|
||||||
(send kmap add-function name func))]
|
(send kmap add-function name func))]
|
||||||
[add-m (λ (name func)
|
[add-m (λ (name func)
|
||||||
|
@ -1413,7 +1416,8 @@
|
||||||
(let* ([map (λ (key func)
|
(let* ([map (λ (key func)
|
||||||
(send kmap map-function key func))]
|
(send kmap map-function key func))]
|
||||||
[map-meta (λ (key func)
|
[map-meta (λ (key func)
|
||||||
(send-map-function-meta kmap key func))]
|
(send-map-function-meta kmap key func
|
||||||
|
(regexp-match has-control-regexp key)))]
|
||||||
[add (λ (name func)
|
[add (λ (name func)
|
||||||
(send kmap add-function name func))]
|
(send kmap add-function name func))]
|
||||||
[add-m (λ (name func)
|
[add-m (λ (name func)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user