/[linedit]/src/terminal-translations.lisp
ViewVC logotype

Contents of /src/terminal-translations.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations)
Tue Apr 27 19:56:54 2004 UTC (9 years, 11 months ago) by jsquires
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +3 -3 lines
 * Fixed encoding of C-M- keys, such that they work on my OS X machine,
   and lisps like openmcl where the control characters aren't named like
   #\Ack.
1 ;;;; Copyright (c) 2003, 2004 Nikodemus Siivola, Julian Squires
2 ;;;;
3 ;;;; Permission is hereby granted, free of charge, to any person obtaining
4 ;;;; a copy of this software and associated documentation files (the
5 ;;;; "Software"), to deal in the Software without restriction, including
6 ;;;; without limitation the rights to use, copy, modify, merge, publish,
7 ;;;; distribute, sublicense, and/or sell copies of the Software, and to
8 ;;;; permit persons to whom the Software is furnished to do so, subject to
9 ;;;; the following conditions:
10 ;;;;
11 ;;;; The above copyright notice and this permission notice shall be included
12 ;;;; in all copies or substantial portions of the Software.
13 ;;;;
14 ;;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 ;;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 ;;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 ;;;; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 ;;;; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 ;;;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 ;;;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 (in-package :linedit)
23
24 (defvar *terminal-translations* (make-hash-table :test #'equalp))
25
26 (defmacro deftrans (name &rest chords)
27 `(dolist (chord ',chords)
28 (let ((old (gethash chord *terminal-translations*)))
29 (when (and old (not (equal old ,name)))
30 (warn "Overriding old translation ~S for ~S with ~S." old chord ,name)))
31 (setf (gethash chord *terminal-translations*) ,name)))
32
33 (deftrans "C-Space" 0)
34 (deftrans "C-A" 1)
35 (deftrans "C-B" 2)
36 (deftrans "C-C" 3)
37 (deftrans "C-D" 4)
38 (deftrans "C-E" 5)
39 (deftrans "C-F" 6)
40 (deftrans "C-G" 7)
41 (deftrans "C-Backspace" 8)
42 (deftrans "Tab" 9)
43 (deftrans "C-K" 11)
44 (deftrans "C-L" 12)
45 (deftrans "Return" 10 13) ;; Newline and return
46 (deftrans "C-N" 14)
47 (deftrans "C-O" 15)
48 (deftrans "C-P" 16)
49 (deftrans "C-Q" 17)
50 (deftrans "C-R" 18)
51 (deftrans "C-S" 19)
52 (deftrans "C-T" 20)
53 (deftrans "C-U" 21)
54 (deftrans "C-V" 22)
55 (deftrans "C-W" 23)
56 (deftrans "C-X" 24)
57 (deftrans "C-Y" 25)
58 (deftrans "C-Z" 26)
59 (deftrans "C--" 31)
60 (deftrans "Backspace" 127)
61
62 (deftrans "M-A" (#\Esc #\A) 225)
63 (deftrans "M-B" (#\Esc #\B) 226)
64 (deftrans "M-C" (#\Esc #\C) 227)
65 (deftrans "M-D" (#\Esc #\D) 228)
66 (deftrans "M-E" (#\Esc #\E) 229)
67 (deftrans "M-F" (#\Esc #\F) 230)
68 (deftrans "M-G" (#\Esc #\G) 231)
69 (deftrans "M-H" (#\Esc #\H) 232)
70 (deftrans "M-I" (#\Esc #\I) 233)
71 (deftrans "M-J" (#\Esc #\J) 234)
72 (deftrans "M-K" (#\Esc #\K) 235)
73 (deftrans "M-L" (#\Esc #\L) 236)
74 (deftrans "M-M" (#\Esc #\M) 237)
75 (deftrans "M-N" (#\Esc #\N) 238)
76 (deftrans "M-O" (#\Esc #\O) 239)
77 (deftrans "M-P" (#\Esc #\P) 240)
78 (deftrans "M-Q" (#\Esc #\Q) 241)
79 (deftrans "M-R" (#\Esc #\R) 242)
80 (deftrans "M-S" (#\Esc #\S) 243)
81 (deftrans "M-T" (#\Esc #\T) 244)
82 (deftrans "M-U" (#\Esc #\U) 245)
83 (deftrans "M-V" (#\Esc #\V) 246)
84 (deftrans "M-W" (#\Esc #\W) 247)
85 (deftrans "M-X" (#\Esc #\X) 248)
86 (deftrans "M-Y" (#\Esc #\Y) 249)
87 (deftrans "M-Z" (#\Esc #\Z) 250)
88 (deftrans "M-0" (#\Esc #\0) 176)
89 (deftrans "M-1" (#\Esc #\1) 177)
90 (deftrans "M-2" (#\Esc #\2) 178)
91 (deftrans "M-3" (#\Esc #\3) 179)
92 (deftrans "M-4" (#\Esc #\4) 180)
93 (deftrans "M-5" (#\Esc #\5) 181)
94 (deftrans "M-6" (#\Esc #\6) 182)
95 (deftrans "M-7" (#\Esc #\7) 183)
96 (deftrans "M-8" (#\Esc #\8) 184)
97 (deftrans "M-9" (#\Esc #\9) 185)
98
99 (deftrans "C-M-f" (#\Esc #\^F) 134)
100 (deftrans "C-M-b" (#\Esc #\^B) 130)
101 (deftrans "C-M-k" (#\Esc #\^K) 139)
102
103 (deftrans "Up-arrow" (#\Esc #\[ #\A))
104 (deftrans "Down-arrow" (#\Esc #\[ #\B))
105 (deftrans "Right-arrow" (#\Esc #\[ #\C))
106 (deftrans "Left-arrow" (#\Esc #\[ #\D))
107 (deftrans "Insert" (#\Esc #\[ #\2 #\~))
108 (deftrans "Delete" (#\Esc #\[ #\3 #\~))
109 (deftrans "C-Delete" (#\Esc #\[ #\3 #\^))
110 (deftrans "Page-up" (#\Esc #\[ #\5 #\~))
111 (deftrans "Page-down" (#\Esc #\[ #\6 #\~))
112 (deftrans "Home" (#\Esc #\[ #\7 #\~) (#\Esc #\[ #\1 #\~) (#\Esc #\[ #\H))
113 (deftrans "End" (#\Esc #\[ #\8 #\~) (#\Esc #\[ #\4 #\~) (#\Esc #\[ #\F))

  ViewVC Help
Powered by ViewVC 1.1.5