Make keyspec parsing/printing properly use byte-strings in unknown-escape-sequence.

This commit is contained in:
Tony Garnock-Jones 2014-12-27 17:22:59 -05:00
parent 5fae56dc78
commit 04f7da73e2
2 changed files with 4 additions and 6 deletions

View File

@ -9,8 +9,5 @@ command handler have everything it needs even in the face of change
Need line wrap of some kind.
unknown-escape-sequence contents are byte strings, and keyseq parsing
and printing should reflect that.
Catch and handle SIGWINCH.
See http://man7.org/tlpi/code/online/dist/tty/demo_SIGWINCH.c.html

View File

@ -48,7 +48,7 @@
(cons '#:default (parse-key-sequence rest))]
[(pregexp "^ *(([cCsSmM]-)*)\"([^\"]*)\"(.*)" (list lexeme modifiers _ stringspec rest))
(define mods (parse-modifiers modifiers lexeme))
(define seq (unknown-escape-sequence (or (read-string-to-end (format "\"~a\"" stringspec))
(define seq (unknown-escape-sequence (or (read-string-to-end (format "#\"~a\"" stringspec))
(bad-key lexeme "Bad raw input sequence"))))
(cons (key seq mods) (parse-key-sequence rest))]
[(pregexp "^ *(([cCsSmM]-)*)<([^>]+)>(( +.*)|$)" (list lexeme modifiers _ symname rest _))
@ -99,8 +99,9 @@
[(key value modifiers)
(define-values (str updated-modifiers)
(match value
[(unknown-escape-sequence s)
(values (format "~v" s) modifiers)]
[(unknown-escape-sequence bs)
(define s (format "~v" bs))
(values (substring s 1 (string-length s)) modifiers)]
[(? symbol? s)
(values (format "<~a>" s) modifiers)]
[#\[ #:when (set-member? modifiers 'control)