Insert control characters only when C-q prefixed
This commit is contained in:
parent
55f9dc864a
commit
4a7219134a
|
@ -12,19 +12,20 @@
|
||||||
(match keyseq
|
(match keyseq
|
||||||
[(list (key (? char? ch) modifiers)) #:when (set-empty? (set-remove modifiers 'shift))
|
[(list (key (? char? ch) modifiers)) #:when (set-empty? (set-remove modifiers 'shift))
|
||||||
(buffer-insert! buf (window-point win) (string->rope (string ch)))]
|
(buffer-insert! buf (window-point win) (string->rope (string ch)))]
|
||||||
[(list (key (? char? ch0) modifiers)) #:when (equal? modifiers (set 'control))
|
|
||||||
(define ch (integer->char (- (char->integer (char-upcase ch0)) (char->integer #\A) -1)))
|
|
||||||
(buffer-insert! buf (window-point win) (string->rope (string ch)))]
|
|
||||||
[_ #f]))
|
[_ #f]))
|
||||||
|
|
||||||
(define-command fundamental-mode (unbound-key-sequence buf #:command cmd #:keyseq keyseq)
|
(define-command fundamental-mode (unbound-key-sequence buf #:command cmd #:keyseq keyseq)
|
||||||
(invoke (copy-command cmd #:selector 'self-insert-command)))
|
(invoke (copy-command cmd #:selector 'self-insert-command)))
|
||||||
|
|
||||||
(define-command fundamental-mode (quoted-insert buf #:command cmd #:keyseq keyseq)
|
(define-command fundamental-mode (quoted-insert buf #:window win #:keyseq keyseq)
|
||||||
#:bind-key "C-q #:default"
|
#:bind-key "C-q #:default"
|
||||||
(invoke (copy-command cmd
|
(match keyseq
|
||||||
#:selector 'self-insert-command
|
[(list _ (key (? char? ch) modifiers)) #:when (set-empty? (set-remove modifiers 'shift))
|
||||||
#:keyseq (list (cadr keyseq)))))
|
(buffer-insert! buf (window-point win) (string->rope (string ch)))]
|
||||||
|
[(list _ (key (? char? ch0) modifiers)) #:when (equal? modifiers (set 'control))
|
||||||
|
(define ch (integer->char (- (char->integer (char-upcase ch0)) (char->integer #\A) -1)))
|
||||||
|
(buffer-insert! buf (window-point win) (string->rope (string ch)))]
|
||||||
|
[_ #f]))
|
||||||
|
|
||||||
(define-command fundamental-mode (newline buf #:window win)
|
(define-command fundamental-mode (newline buf #:window win)
|
||||||
#:bind-key "C-m"
|
#:bind-key "C-m"
|
||||||
|
|
Loading…
Reference in New Issue